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

GameInfo: Enable Modify button only when the game has SDLs

Add icons to the DLC install/uninstall buttons
This commit is contained in:
loathingKernel 2023-09-04 00:23:14 +03:00
parent d53eb92e53
commit 43766c82a4
No known key found for this signature in database
GPG key ID: CE0C72D0B53821FD
4 changed files with 13 additions and 3 deletions

View file

@ -194,7 +194,6 @@ class InstallDialog(QDialog):
config_disable_sdl = self.core.lgd.config.getboolean(self.rgame.app_name, 'disable_sdl', fallback=False)
sdl_name = get_sdl_appname(self.rgame.app_name)
if not config_disable_sdl and sdl_name is not None:
# FIXME: this should be updated whenever platform changes
sdl_data = self.core.get_sdl_data(sdl_name, platform=platform)
if sdl_data:
widget = QWidget(self.selectable)

View file

@ -9,7 +9,7 @@ from rare.ui.components.tabs.games.game_info.game_dlc import Ui_GameDlc
from rare.ui.components.tabs.games.game_info.game_dlc_widget import Ui_GameDlcWidget
from rare.widgets.image_widget import ImageWidget, ImageSize
from rare.widgets.side_tab import SideTabContents
from rare.utils.misc import widget_object_name
from rare.utils.misc import widget_object_name, icon
class GameDlcWidget(QFrame):
@ -48,6 +48,7 @@ class InstalledGameDlcWidget(GameDlcWidget):
self.ui.action_button.setObjectName("UninstallButton")
self.ui.action_button.clicked.connect(self.uninstall_dlc)
self.ui.action_button.setText(self.tr("Uninstall DLC"))
self.ui.action_button.setIcon(icon("ri.uninstall-line"))
# lk: don't reference `self.rdlc` here because the object has been deleted
rdlc.signals.game.uninstalled.connect(self.__uninstalled)
@ -68,6 +69,8 @@ class AvailableGameDlcWidget(GameDlcWidget):
self.ui.action_button.setObjectName("InstallButton")
self.ui.action_button.clicked.connect(self.install_dlc)
self.ui.action_button.setText(self.tr("Install DLC"))
self.ui.action_button.setIcon(icon("ri.install-line"))
# lk: don't reference `self.rdlc` here because the object has been deleted
rdlc.signals.game.installed.connect(self.__installed)

View file

@ -303,7 +303,10 @@ class GameInfo(QWidget, SideTabContents):
)
self.ui.modify_button.setEnabled(
self.rgame.is_installed and (not self.rgame.is_non_asset) and self.rgame.is_idle
self.rgame.is_installed
and (not self.rgame.is_non_asset)
and self.rgame.is_idle
and self.rgame.sdl_name is not None
)
self.ui.verify_button.setEnabled(

View file

@ -10,6 +10,7 @@ from typing import List, Optional, Dict, Set
from PyQt5.QtCore import QRunnable, pyqtSlot, QProcess, QThreadPool
from PyQt5.QtGui import QPixmap
from legendary.models.game import Game, InstalledGame
from legendary.utils.selective_dl import get_sdl_appname
from rare.lgndr.core import LegendaryCore
from rare.models.install import InstallOptionsModel, UninstallOptionsModel
@ -451,6 +452,10 @@ class RareGame(RareGameSlim):
else self.app_title
)
@property
def sdl_name(self) -> Optional[str]:
return get_sdl_appname(self.app_name)
@property
def save_path(self) -> Optional[str]:
return super(RareGame, self).save_path