diff --git a/rare/app.py b/rare/app.py index 46a4fe40..d4fe5e97 100644 --- a/rare/app.py +++ b/rare/app.py @@ -134,8 +134,7 @@ class App(QApplication): self.launch_dialog.start_app.connect(self.start_app) self.launch_dialog.start_app.connect(self.launch_dialog.close) - if not self.args.silent or self.args.subparser == "launch": - self.launch_dialog.login() + self.launch_dialog.login() def start_app(self): self.mainwindow = MainWindow() @@ -148,6 +147,18 @@ class App(QApplication): if not self.args.silent: self.mainwindow.show() + if shared.args.subparser == "launch": + if shared.args.app_name in [i.app_name for i in self.core.get_installed_list()]: + logger.info("Launching " + self.core.get_installed_game(shared.args.app_name).title) + self.mainwindow.tab_widget.games_tab.game_utils.prepare_launch(shared.args.app_name) + else: + logger.error( + f"Could not find {shared.args.app_name} in Games or it is not installed") + QMessageBox.warning(self.mainwindow, "Warning", + self.tr( + "Could not find {} in installed games. Did you modify the shortcut? ").format( + shared.args.app_name)) + def tray(self, reason): if reason == QSystemTrayIcon.DoubleClick: self.mainwindow.show() diff --git a/rare/components/dialogs/launch_dialog.py b/rare/components/dialogs/launch_dialog.py index 9c06b5ef..97391e90 100644 --- a/rare/components/dialogs/launch_dialog.py +++ b/rare/components/dialogs/launch_dialog.py @@ -106,7 +106,8 @@ class LaunchDialog(QDialog, Ui_LaunchDialog): self.offline = True finally: if do_launch: - self.show() + if not shared.args.silent: + self.show() self.launch() else: self.quit_app.emit(0) @@ -143,7 +144,14 @@ class LaunchDialog(QDialog, Ui_LaunchDialog): else: self.finished = 2 - self.api_results.game_list, self.api_results.dlcs = self.core.get_game_and_dlc_list(False) + if self.core.lgd.assets: + self.api_results.game_list, self.api_results.dlcs = self.core.get_game_and_dlc_list(False) + self.api_results.bit32_games = list(map(lambda i: i.app_name, self.core.get_game_list(False, "Win32"))) + self.api_results.mac_games = list(map(lambda i: i.app_name, self.core.get_game_list(False, "Mac"))) + else: + logger.warning("No assets found. Falling back to empty game lists") + self.api_results.game_list, self.api_results.dlcs = [], {} + self.api_results.mac_games = self.api_results.bit32_games = [] self.finish() def handle_api_worker_result(self, result, text): diff --git a/rare/components/main_window.py b/rare/components/main_window.py index cd817219..1eae578e 100644 --- a/rare/components/main_window.py +++ b/rare/components/main_window.py @@ -55,14 +55,6 @@ class MainWindow(QMainWindow): if not shared.args.offline: self.rpc = DiscordRPC() - if shared.args.subparser == "launch": - if shared.args.app_name in [i.app_name for i in self.core.get_installed_list()]: - logger.info("Launching " + self.core.get_installed_game(shared.args.app_name).title) - self.tab_widget.games_tab.game_utils.prepare_launch(shared.args.app_name) - else: - logger.info( - f"Could not find {shared.args.app_name} in Games or it is not installed") - self.timer = QTimer() self.timer.timeout.connect(self.timer_finished) self.timer.start(1000) diff --git a/rare/components/tabs/games/game_info/__init__.py b/rare/components/tabs/games/game_info/__init__.py index e4172abd..801240e6 100644 --- a/rare/components/tabs/games/game_info/__init__.py +++ b/rare/components/tabs/games/game_info/__init__.py @@ -10,7 +10,7 @@ from ..game_utils import GameUtils class GameInfoTabs(SideTabWidget): - def __init__(self, dlcs: list, game_utils: GameUtils, parent=None): + def __init__(self, dlcs: dict, game_utils: GameUtils, parent=None): super(GameInfoTabs, self).__init__(show_back=True, parent=parent) self.core = shared.core self.signals = shared.signals @@ -33,7 +33,7 @@ class GameInfoTabs(SideTabWidget): self.settings.update_game(app_name) # DLC Tab: Disable if no dlcs available - if len(self.dlc_list[self.core.get_game(app_name).catalog_item_id]) == 0: + if len(self.dlc_list.get(self.core.get_game(app_name).catalog_item_id, [])) == 0: self.setTabEnabled(3, False) else: self.setTabEnabled(3, True) diff --git a/rare/components/tabs/games/game_info/game_dlc.py b/rare/components/tabs/games/game_info/game_dlc.py index 86d343c4..6a857d1f 100644 --- a/rare/components/tabs/games/game_info/game_dlc.py +++ b/rare/components/tabs/games/game_info/game_dlc.py @@ -15,7 +15,7 @@ class GameDlc(QWidget, Ui_GameDlc): install_dlc = pyqtSignal(str, bool) game: Game - def __init__(self, dlcs: list, game_utils: GameUtils, parent=None): + def __init__(self, dlcs: dict, game_utils: GameUtils, parent=None): super(GameDlc, self).__init__(parent=parent) self.setupUi(self) self.game_utils = game_utils diff --git a/rare/components/tabs/games/game_info/game_info.py b/rare/components/tabs/games/game_info/game_info.py index 4cab761a..c5a42c71 100644 --- a/rare/components/tabs/games/game_info/game_info.py +++ b/rare/components/tabs/games/game_info/game_info.py @@ -44,10 +44,13 @@ class GameInfo(QWidget, Ui_GameInfo): self.uninstall_button.clicked.connect(self.uninstall) self.verify_button.clicked.connect(self.verify) - self.repair_button.clicked.connect(self.repair) self.verify_pool = QThreadPool() self.verify_pool.setMaxThreadCount(2) + if shared.args.offline: + self.repair_button.setDisabled(True) + else: + self.repair_button.clicked.connect(self.repair) def uninstall(self): if self.game_utils.uninstall_game(self.game.app_name): @@ -142,7 +145,8 @@ class GameInfo(QWidget, Ui_GameInfo): else: self.uninstall_button.setDisabled(False) self.verify_button.setDisabled(False) - self.repair_button.setDisabled(False) + if not shared.args.offline: + self.repair_button.setDisabled(False) self.game_actions_stack.setCurrentIndex(0) if platform.system() != "Windows": diff --git a/rare/components/tabs/games/game_widgets/base_installed_widget.py b/rare/components/tabs/games/game_widgets/base_installed_widget.py index d1a516c6..2862ca3b 100644 --- a/rare/components/tabs/games/game_widgets/base_installed_widget.py +++ b/rare/components/tabs/games/game_widgets/base_installed_widget.py @@ -55,8 +55,9 @@ class BaseInstalledWidget(QGroupBox): self.game_running = False self.offline = shared.args.offline self.update_available = False - if self.game.third_party_store != "Origin" or self.igame: - remote_version = self.core.get_asset(self.game.app_name, platform=self.igame.platform, update=False).build_version + if (self.game.third_party_store != "Origin" or self.igame) and self.core.lgd.assets: + remote_version = self.core.get_asset(self.game.app_name, platform=self.igame.platform, + update=False).build_version if remote_version != self.igame.version: self.update_available = True diff --git a/rare/components/tabs/shop/shop_api_core.py b/rare/components/tabs/shop/shop_api_core.py index d6c1142d..d05bc29f 100644 --- a/rare/components/tabs/shop/shop_api_core.py +++ b/rare/components/tabs/shop/shop_api_core.py @@ -71,7 +71,7 @@ class ShopApiCore(QObject): def search_game(self, name, handle_func): payload = { "query": search_query, - "variables": {"category": "games/edition/base|bundles/games|editors|software/edition/base", "count": 1, + "variables": {"category": "games/edition/base|bundles/games|editors|software/edition/base", "count": 10, "country": self.country_code, "keywords": name, "locale": self.locale, "sortDir": "DESC", "allowCountries": self.country_code, "start": 0, "tag": "", "withMapping": False, "withPrice": True} diff --git a/rare/utils/models.py b/rare/utils/models.py index 7c3fa952..76b6c3e1 100644 --- a/rare/utils/models.py +++ b/rare/utils/models.py @@ -96,7 +96,7 @@ class PathSpec: @dataclass class ApiResults: game_list: list = None - dlcs: list = None + dlcs: dict = None bit32_games: list = None mac_games: list = None no_asset_games: list = None