diff --git a/rare/commands/launcher/cloud_sync_dialog.py b/rare/commands/launcher/cloud_sync_dialog.py index 7d1252f1a..5ec2271d7 100644 --- a/rare/commands/launcher/cloud_sync_dialog.py +++ b/rare/commands/launcher/cloud_sync_dialog.py @@ -59,8 +59,11 @@ def __init__(self, igame: InstalledGame, dt_local: datetime, dt_remote: datetime else: self.status = CloudSyncDialogResult.SKIP - self.sync_ui.date_info_local.setText(dt_local.strftime("%A, %d. %B %Y %X") if dt_local else "None") - self.sync_ui.date_info_remote.setText(dt_remote.strftime("%A, %d. %B %Y %X") if dt_remote else "None") + local_tz = datetime.now().astimezone().tzinfo + self.sync_ui.date_info_local.setText( + dt_local.astimezone(local_tz).strftime("%A, %d %B %Y %X") if dt_local else "None") + self.sync_ui.date_info_remote.setText( + dt_remote.astimezone(local_tz).strftime("%A, %d %B %Y %X") if dt_remote else "None") self.sync_ui.icon_local.setPixmap(qta_icon("mdi.harddisk", "fa.desktop").pixmap(128, 128)) self.sync_ui.icon_remote.setPixmap(qta_icon("mdi.cloud-outline", "ei.cloud").pixmap(128, 128)) diff --git a/rare/components/tabs/library/details/cloud_saves.py b/rare/components/tabs/library/details/cloud_saves.py index 2da7d199e..64a888b50 100644 --- a/rare/components/tabs/library/details/cloud_saves.py +++ b/rare/components/tabs/library/details/cloud_saves.py @@ -1,5 +1,6 @@ import os import platform +from datetime import datetime from logging import getLogger from typing import Tuple @@ -23,8 +24,8 @@ from rare.shared.workers.wine_resolver import WineSavePathResolver from rare.ui.components.tabs.games.game_info.cloud_settings_widget import Ui_CloudSettingsWidget from rare.ui.components.tabs.games.game_info.cloud_sync_widget import Ui_CloudSyncWidget -from rare.utils.misc import qta_icon from rare.utils.metrics import timelogger +from rare.utils.misc import qta_icon from rare.widgets.indicator_edit import PathEdit, IndicatorReasonsCommon from rare.widgets.loading_widget import LoadingWidget from rare.widgets.side_tab import SideTabContents @@ -188,12 +189,11 @@ def __update_widget(self): status, (dt_local, dt_remote) = self.rgame.save_game_state + local_tz = datetime.now().astimezone().tzinfo self.sync_ui.date_info_local.setText( - dt_local.strftime("%A, %d. %B %Y %X") if dt_local and self.rgame.save_path else "None" - ) + dt_local.astimezone(local_tz).strftime("%A, %d %B %Y %X") if dt_local else "None") self.sync_ui.date_info_remote.setText( - dt_remote.strftime("%A, %d. %B %Y %X") if dt_remote and self.rgame.save_path else "None" - ) + dt_remote.astimezone(local_tz).strftime("%A, %d %B %Y %X") if dt_remote else "None") newer = self.tr("Newer") self.sync_ui.age_label_local.setText( diff --git a/rare/components/tabs/library/integrations/ubisoft_group.py b/rare/components/tabs/library/integrations/ubisoft_group.py index 7bb99cb71..2cbebff56 100644 --- a/rare/components/tabs/library/integrations/ubisoft_group.py +++ b/rare/components/tabs/library/integrations/ubisoft_group.py @@ -67,7 +67,7 @@ def run_real(self) -> None: self.signals.worker_finished.emit(redeemed, entitlements, ubi_account_id) except Exception as e: - logger.error(str(e)) + logger.error(e) self.signals.worker_finished.emit(set(), set(), "error") @@ -107,31 +107,31 @@ def __init__(self, game: Game, ubi_account_id, activated: bool = False, parent=N self.game = game self.ubi_account_id = ubi_account_id - self.ok_indicator = QLabel(parent=self) - self.ok_indicator.setPixmap(qta_icon("fa.circle-o", color="grey").pixmap(20, 20)) - self.ok_indicator.setSizePolicy(QSizePolicy.Policy.Maximum, QSizePolicy.Policy.Preferred) + self.redeem_indicator = QLabel(parent=self) + self.redeem_indicator.setPixmap(qta_icon("fa.circle-o", color="grey").pixmap(20, 20)) + self.redeem_indicator.setSizePolicy(QSizePolicy.Policy.Maximum, QSizePolicy.Policy.Preferred) self.title_label = ElideLabel(game.app_title, parent=self) - self.link_button = QPushButton(self.tr("Redeem in Ubisoft"), parent=self) - self.link_button.setMinimumWidth(150) - self.link_button.clicked.connect(self.activate) + self.redeem_button = QPushButton(self.tr("Redeem in Ubisoft"), parent=self) + self.redeem_button.setMinimumWidth(150) + self.redeem_button.clicked.connect(self.activate) if activated: - self.link_button.setText(self.tr("Already activated")) - self.link_button.setDisabled(True) - self.ok_indicator.setPixmap(qta_icon("fa.check-circle-o", color="green").pixmap(QSize(20, 20))) + self.redeem_button.setText(self.tr("Already activated")) + self.redeem_button.setDisabled(True) + self.redeem_indicator.setPixmap(qta_icon("fa.check-circle-o", color="green").pixmap(QSize(20, 20))) layout = QHBoxLayout(self) layout.setContentsMargins(-1, 0, 0, 0) - layout.addWidget(self.ok_indicator) + layout.addWidget(self.redeem_indicator) layout.addWidget(self.title_label, stretch=1) - layout.addWidget(self.link_button) + layout.addWidget(self.redeem_button) def activate(self): - self.link_button.setDisabled(True) + self.redeem_button.setDisabled(True) # self.ok_indicator.setPixmap(icon("mdi.loading", color="grey").pixmap(20, 20)) - self.ok_indicator.setPixmap(qta_icon("mdi.transit-connection-horizontal", color="grey").pixmap(20, 20)) + self.redeem_indicator.setPixmap(qta_icon("mdi.transit-connection-horizontal", color="grey").pixmap(20, 20)) if self.args.debug: worker = UbiConnectWorker(RareCore.instance().core(), None, None) @@ -144,14 +144,14 @@ def activate(self): def worker_finished(self, error): if not error: - self.ok_indicator.setPixmap(qta_icon("fa.check-circle-o", color="green").pixmap(QSize(20, 20))) - self.link_button.setDisabled(True) - self.link_button.setText(self.tr("Already activated")) + self.redeem_indicator.setPixmap(qta_icon("fa.check-circle-o", color="green").pixmap(QSize(20, 20))) + self.redeem_button.setDisabled(True) + self.redeem_button.setText(self.tr("Already activated")) else: - self.ok_indicator.setPixmap(qta_icon("fa.times-circle-o", color="red").pixmap(QSize(20, 20))) - self.ok_indicator.setToolTip(error) - self.link_button.setText(self.tr("Try again")) - self.link_button.setDisabled(False) + self.redeem_indicator.setPixmap(qta_icon("fa.times-circle-o", color="red").pixmap(QSize(20, 20))) + self.redeem_indicator.setToolTip(error) + self.redeem_button.setText(self.tr("Try again")) + self.redeem_button.setDisabled(False) class UbisoftGroup(QGroupBox): @@ -167,19 +167,19 @@ def __init__(self, parent=None): self.info_label = QLabel(parent=self) self.info_label.setText(self.tr("Getting information about your redeemable Ubisoft games.")) - self.browser_button = QPushButton(self.tr("Link Ubisoft acccount"), parent=self) - self.browser_button.setMinimumWidth(140) - self.browser_button.clicked.connect( + self.link_button = QPushButton(self.tr("Link Ubisoft acccount"), parent=self) + self.link_button.setMinimumWidth(140) + self.link_button.clicked.connect( lambda: webbrowser.open("https://www.epicgames.com/id/link/ubisoft") ) - self.browser_button.setEnabled(False) + self.link_button.setEnabled(False) self.loading_widget = LoadingWidget(self) self.loading_widget.stop() header_layout = QHBoxLayout() header_layout.addWidget(self.info_label, stretch=1) - header_layout.addWidget(self.browser_button) + header_layout.addWidget(self.link_button) layout = QVBoxLayout(self) layout.addLayout(header_layout) @@ -204,6 +204,7 @@ def showEvent(self, a0: QShowEvent) -> None: @Slot(set, set, str) def show_ubi_games(self, redeemed: set, entitlements: set, ubi_account_id: str): self.worker = None + self.loading_widget.stop() if not redeemed and ubi_account_id != "error": logger.error( "No linked ubisoft account found! Link your accounts via your browser and try again." @@ -211,14 +212,14 @@ def show_ubi_games(self, redeemed: set, entitlements: set, ubi_account_id: str): self.info_label.setText( self.tr("Your account is not linked with Ubisoft. Please link your account and try again.") ) - self.browser_button.setEnabled(True) + self.link_button.setEnabled(True) elif ubi_account_id == "error": self.info_label.setText( self.tr("An error has occurred while requesting your account's Ubisoft information.") ) - self.browser_button.setEnabled(True) + self.link_button.setEnabled(True) else: - self.browser_button.setEnabled(False) + self.link_button.setEnabled(False) uplay_games = [] activated = 0 @@ -257,8 +258,6 @@ def show_ubi_games(self, redeemed: set, entitlements: set, ubi_account_id: str): ) logger.info(f"Found {len(uplay_games) - activated} game(s) to redeem.") - self.loading_widget.stop() - for game in uplay_games: widget = UbiLinkWidget( game, ubi_account_id, activated=game.partner_link_id in redeemed, parent=self @@ -273,4 +272,4 @@ def show_ubi_games(self, redeemed: set, entitlements: set, ubi_account_id: str): parent=self, ) self.layout().addWidget(widget) - self.browser_button.setEnabled(True) + self.link_button.setEnabled(True) diff --git a/rare/components/tabs/library/widgets/game_widget.py b/rare/components/tabs/library/widgets/game_widget.py index e53913caa..d241f2df9 100644 --- a/rare/components/tabs/library/widgets/game_widget.py +++ b/rare/components/tabs/library/widgets/game_widget.py @@ -202,6 +202,10 @@ def update_actions(self): def eventFilter(self, a0: QObject, a1: QEvent) -> bool: if not isinstance(a1, QEvent): # FIXME: investigate why this happens + # + # ERROR: Supplied arg1 <class 'PySide6.QtCore.QRunnable'> with target \ + # <class 'rare.components.tabs.library.widgets.icon_game_widget.IconGameWidget'> \ + # is not a QEvent object logger.error("Supplied arg1 %s with target %s is not a QEvent object", type(a1), type(a0)) return True if a0 is self.ui.launch_btn: diff --git a/rare/utils/steam_shortcuts.py b/rare/utils/steam_shortcuts.py index 5245e3fa6..6fee380cd 100644 --- a/rare/utils/steam_shortcuts.py +++ b/rare/utils/steam_shortcuts.py @@ -42,6 +42,8 @@ def find_steam() -> Optional[str]: def find_steam_users(steam_path: str) -> List[SteamUser]: _users = [] vdf_path = os.path.join(steam_path, "config", "loginusers.vdf") + if not os.path.exists(vdf_path): + return _users with open(vdf_path, 'r') as f: users = vdf.load(f).get("users", {}) for long_id, user in users.items():