Fix many bugs:
- launch command - offline mode - shop search results shows more than 1 game
This commit is contained in:
parent
ba9ac234cd
commit
e370841532
15
rare/app.py
15
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.start_app)
|
||||||
self.launch_dialog.start_app.connect(self.launch_dialog.close)
|
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):
|
def start_app(self):
|
||||||
self.mainwindow = MainWindow()
|
self.mainwindow = MainWindow()
|
||||||
|
@ -148,6 +147,18 @@ class App(QApplication):
|
||||||
if not self.args.silent:
|
if not self.args.silent:
|
||||||
self.mainwindow.show()
|
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):
|
def tray(self, reason):
|
||||||
if reason == QSystemTrayIcon.DoubleClick:
|
if reason == QSystemTrayIcon.DoubleClick:
|
||||||
self.mainwindow.show()
|
self.mainwindow.show()
|
||||||
|
|
|
@ -106,7 +106,8 @@ class LaunchDialog(QDialog, Ui_LaunchDialog):
|
||||||
self.offline = True
|
self.offline = True
|
||||||
finally:
|
finally:
|
||||||
if do_launch:
|
if do_launch:
|
||||||
self.show()
|
if not shared.args.silent:
|
||||||
|
self.show()
|
||||||
self.launch()
|
self.launch()
|
||||||
else:
|
else:
|
||||||
self.quit_app.emit(0)
|
self.quit_app.emit(0)
|
||||||
|
@ -143,7 +144,14 @@ class LaunchDialog(QDialog, Ui_LaunchDialog):
|
||||||
|
|
||||||
else:
|
else:
|
||||||
self.finished = 2
|
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()
|
self.finish()
|
||||||
|
|
||||||
def handle_api_worker_result(self, result, text):
|
def handle_api_worker_result(self, result, text):
|
||||||
|
|
|
@ -55,14 +55,6 @@ class MainWindow(QMainWindow):
|
||||||
if not shared.args.offline:
|
if not shared.args.offline:
|
||||||
self.rpc = DiscordRPC()
|
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 = QTimer()
|
||||||
self.timer.timeout.connect(self.timer_finished)
|
self.timer.timeout.connect(self.timer_finished)
|
||||||
self.timer.start(1000)
|
self.timer.start(1000)
|
||||||
|
|
|
@ -10,7 +10,7 @@ from ..game_utils import GameUtils
|
||||||
|
|
||||||
|
|
||||||
class GameInfoTabs(SideTabWidget):
|
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)
|
super(GameInfoTabs, self).__init__(show_back=True, parent=parent)
|
||||||
self.core = shared.core
|
self.core = shared.core
|
||||||
self.signals = shared.signals
|
self.signals = shared.signals
|
||||||
|
@ -33,7 +33,7 @@ class GameInfoTabs(SideTabWidget):
|
||||||
self.settings.update_game(app_name)
|
self.settings.update_game(app_name)
|
||||||
|
|
||||||
# DLC Tab: Disable if no dlcs available
|
# 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)
|
self.setTabEnabled(3, False)
|
||||||
else:
|
else:
|
||||||
self.setTabEnabled(3, True)
|
self.setTabEnabled(3, True)
|
||||||
|
|
|
@ -15,7 +15,7 @@ class GameDlc(QWidget, Ui_GameDlc):
|
||||||
install_dlc = pyqtSignal(str, bool)
|
install_dlc = pyqtSignal(str, bool)
|
||||||
game: Game
|
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)
|
super(GameDlc, self).__init__(parent=parent)
|
||||||
self.setupUi(self)
|
self.setupUi(self)
|
||||||
self.game_utils = game_utils
|
self.game_utils = game_utils
|
||||||
|
|
|
@ -44,10 +44,13 @@ class GameInfo(QWidget, Ui_GameInfo):
|
||||||
|
|
||||||
self.uninstall_button.clicked.connect(self.uninstall)
|
self.uninstall_button.clicked.connect(self.uninstall)
|
||||||
self.verify_button.clicked.connect(self.verify)
|
self.verify_button.clicked.connect(self.verify)
|
||||||
self.repair_button.clicked.connect(self.repair)
|
|
||||||
|
|
||||||
self.verify_pool = QThreadPool()
|
self.verify_pool = QThreadPool()
|
||||||
self.verify_pool.setMaxThreadCount(2)
|
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):
|
def uninstall(self):
|
||||||
if self.game_utils.uninstall_game(self.game.app_name):
|
if self.game_utils.uninstall_game(self.game.app_name):
|
||||||
|
@ -142,7 +145,8 @@ class GameInfo(QWidget, Ui_GameInfo):
|
||||||
else:
|
else:
|
||||||
self.uninstall_button.setDisabled(False)
|
self.uninstall_button.setDisabled(False)
|
||||||
self.verify_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)
|
self.game_actions_stack.setCurrentIndex(0)
|
||||||
|
|
||||||
if platform.system() != "Windows":
|
if platform.system() != "Windows":
|
||||||
|
|
|
@ -55,8 +55,9 @@ class BaseInstalledWidget(QGroupBox):
|
||||||
self.game_running = False
|
self.game_running = False
|
||||||
self.offline = shared.args.offline
|
self.offline = shared.args.offline
|
||||||
self.update_available = False
|
self.update_available = False
|
||||||
if self.game.third_party_store != "Origin" or self.igame:
|
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
|
remote_version = self.core.get_asset(self.game.app_name, platform=self.igame.platform,
|
||||||
|
update=False).build_version
|
||||||
if remote_version != self.igame.version:
|
if remote_version != self.igame.version:
|
||||||
self.update_available = True
|
self.update_available = True
|
||||||
|
|
||||||
|
|
|
@ -71,7 +71,7 @@ class ShopApiCore(QObject):
|
||||||
def search_game(self, name, handle_func):
|
def search_game(self, name, handle_func):
|
||||||
payload = {
|
payload = {
|
||||||
"query": search_query,
|
"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",
|
"country": self.country_code, "keywords": name, "locale": self.locale, "sortDir": "DESC",
|
||||||
"allowCountries": self.country_code,
|
"allowCountries": self.country_code,
|
||||||
"start": 0, "tag": "", "withMapping": False, "withPrice": True}
|
"start": 0, "tag": "", "withMapping": False, "withPrice": True}
|
||||||
|
|
|
@ -96,7 +96,7 @@ class PathSpec:
|
||||||
@dataclass
|
@dataclass
|
||||||
class ApiResults:
|
class ApiResults:
|
||||||
game_list: list = None
|
game_list: list = None
|
||||||
dlcs: list = None
|
dlcs: dict = None
|
||||||
bit32_games: list = None
|
bit32_games: list = None
|
||||||
mac_games: list = None
|
mac_games: list = None
|
||||||
no_asset_games: list = None
|
no_asset_games: list = None
|
||||||
|
|
Loading…
Reference in a new issue