1
0
Fork 0
mirror of synced 2024-06-02 02:34:40 +12:00

InstallDialog: Expose platforms in RareGame and use it

to populate the combobox
This commit is contained in:
loathingKernel 2023-09-04 13:23:13 +03:00
parent 43766c82a4
commit f2c575e082
No known key found for this signature in database
GPG key ID: CE0C72D0B53821FD
2 changed files with 17 additions and 9 deletions

View file

@ -97,12 +97,8 @@ class InstallDialog(QDialog):
self.error_box()
platforms = ["Windows"]
if self.rgame.is_win32:
platforms.append("Win32")
if self.rgame.is_mac:
platforms.append("Mac")
self.ui.platform_combo.addItems(platforms)
platforms = self.rgame.platforms
self.ui.platform_combo.addItems(reversed(platforms))
self.ui.platform_combo.currentIndexChanged.connect(lambda: self.option_changed(None))
self.ui.platform_combo.currentIndexChanged.connect(lambda: self.error_box())
self.ui.platform_combo.currentIndexChanged.connect(
@ -115,8 +111,11 @@ class InstallDialog(QDialog):
if (self.ui.platform_combo.currentText() == "Mac" and pf.system() != "Darwin")
else None
)
if pf.system() == "Darwin" and "Mac" in platforms:
self.ui.platform_combo.setCurrentIndex(platforms.index("Mac"))
self.ui.platform_combo.setCurrentIndex(
self.ui.platform_combo.findText(
"Mac" if (pf.system() == "Darwin" and "Mac" in platforms) else "Windows"
)
)
self.ui.platform_combo.currentTextChanged.connect(self.setup_sdl_list)
self.advanced.ui.max_workers_spin.setValue(self.core.lgd.config.getint("Legendary", "max_workers", fallback=0))
@ -137,7 +136,7 @@ class InstallDialog(QDialog):
self.selectable_checks: List[TagCheckBox] = []
self.config_tags: Optional[List[str]] = None
self.setup_sdl_list("Mac" if pf.system() == "Darwin" and "Mac" in platforms else "Windows")
self.setup_sdl_list(self.ui.platform_combo.currentText())
self.ui.install_button.setEnabled(False)

View file

@ -141,6 +141,15 @@ class RareGameSlim(RareGameBase):
def set_installed(self, installed: bool) -> None:
pass
@property
def platforms(self) -> Tuple:
"""!
@brief Property that holds the platforms a game is available for
@return Tuple
"""
return tuple(self.game.asset_infos.keys())
@property
def is_mac(self) -> bool:
"""!