RareGameBase: Add default_platform
property
This property reports the default platform to use for a game based on legendary's configuration and if they platform is available in the game's assets. Using that property we can make better choices on what platform to operate on without user intervention. Currently we use it to infer the platform in when installing, importing, and calculating game versions.
This commit is contained in:
parent
447d704de3
commit
5f5e471169
|
@ -78,9 +78,7 @@ class InstallDialog(QDialog):
|
|||
elif rgame.is_installed:
|
||||
base_path = rgame.install_path
|
||||
else:
|
||||
base_path = self.core.get_default_install_dir(
|
||||
self.core.default_platform if self.core.default_platform in rgame.platforms else "Windows"
|
||||
)
|
||||
base_path = self.core.get_default_install_dir(rgame.default_platform)
|
||||
|
||||
self.install_dir_edit = PathEdit(
|
||||
path=base_path,
|
||||
|
@ -103,13 +101,7 @@ class InstallDialog(QDialog):
|
|||
self.error_box()
|
||||
|
||||
self.ui.platform_combo.addItems(reversed(rgame.platforms))
|
||||
combo_text = (
|
||||
rgame.igame.platform
|
||||
if rgame.is_installed
|
||||
else self.core.default_platform
|
||||
if self.core.default_platform in rgame.platforms
|
||||
else "Windows"
|
||||
)
|
||||
combo_text = rgame.igame.platform if rgame.is_installed else rgame.default_platform
|
||||
self.ui.platform_combo.setCurrentIndex(self.ui.platform_combo.findText(combo_text))
|
||||
self.ui.platform_combo.currentIndexChanged.connect(lambda i: self.option_changed(None))
|
||||
self.ui.platform_combo.currentIndexChanged.connect(self.check_incompatible_platform)
|
||||
|
|
|
@ -286,7 +286,7 @@ class GameInfo(QWidget, SideTabContents):
|
|||
self.ui.platform.setText(
|
||||
self.rgame.igame.platform
|
||||
if self.rgame.is_installed and not self.rgame.is_non_asset
|
||||
else self.core.default_platform
|
||||
else self.rgame.default_platform
|
||||
)
|
||||
|
||||
self.ui.lbl_grade.setDisabled(
|
||||
|
|
|
@ -253,10 +253,10 @@ class ImportGroup(QGroupBox):
|
|||
|
||||
def set_game(self, app_name: str):
|
||||
if app_name:
|
||||
game = self.rcore.get_game(app_name)
|
||||
folder = game.folder_name
|
||||
platform = self.core.default_platform if self.core.default_platform in game.platforms else "Windows"
|
||||
self.path_edit.setText(os.path.join(self.core.get_default_install_dir(platform), folder))
|
||||
rgame = self.rcore.get_game(app_name)
|
||||
self.path_edit.setText(
|
||||
os.path.join(self.core.get_default_install_dir(rgame.default_platform), rgame.folder_name)
|
||||
)
|
||||
self.app_name_edit.setText(app_name)
|
||||
|
||||
def path_edit_callback(self, path) -> Tuple[bool, str, int]:
|
||||
|
|
|
@ -121,6 +121,10 @@ class RareGameBase(QObject):
|
|||
"""
|
||||
return tuple(self.game.asset_infos.keys())
|
||||
|
||||
@property
|
||||
def default_platform(self) -> str:
|
||||
return self.core.default_platform if self.core.default_platform in self.platforms else "Windows"
|
||||
|
||||
@property
|
||||
def is_mac(self) -> bool:
|
||||
"""!
|
||||
|
@ -169,7 +173,7 @@ class RareGameBase(QObject):
|
|||
|
||||
@return str The current version of the game
|
||||
"""
|
||||
return self.igame.version if self.igame is not None else self.game.app_version(self.core.default_platform)
|
||||
return self.igame.version if self.igame is not None else self.game.app_version(self.default_platform)
|
||||
|
||||
@property
|
||||
def install_path(self) -> Optional[str]:
|
||||
|
|
|
@ -167,7 +167,7 @@ class RareGame(RareGameSlim):
|
|||
def update_game(self):
|
||||
self.game = self.core.get_game(
|
||||
self.app_name, update_meta=False,
|
||||
platform=self.igame.platform if self.igame else self.core.default_platform
|
||||
platform=self.igame.platform if self.igame else self.default_platform
|
||||
)
|
||||
|
||||
def update_igame(self):
|
||||
|
@ -229,7 +229,7 @@ class RareGame(RareGameSlim):
|
|||
if self.igame is not None:
|
||||
return self.game.app_version(self.igame.platform)
|
||||
else:
|
||||
return self.game.app_version(self.core.default_platform)
|
||||
return self.game.app_version(self.default_platform)
|
||||
|
||||
@property
|
||||
def has_update(self) -> bool:
|
||||
|
|
Loading…
Reference in a new issue