diff --git a/rare/components/dialogs/cloud_save_dialog.py b/rare/components/dialogs/cloud_save_dialog.py index 640efe41..7d64c318 100644 --- a/rare/components/dialogs/cloud_save_dialog.py +++ b/rare/components/dialogs/cloud_save_dialog.py @@ -18,6 +18,7 @@ class CloudSaveDialog(QDialog, Ui_SyncSaveDialog): DOWNLOAD = 2 UPLOAD = 1 CANCEL = 0 + SKIP = 3 def __init__( self, @@ -49,10 +50,13 @@ class CloudSaveDialog(QDialog, Ui_SyncSaveDialog): self.sync_ui.age_label_remote.setText( f"{newer}" if dt_remote > dt_local else " " ) + # Set status, if one of them is None elif dt_remote and not dt_local: self.status = self.DOWNLOAD - else: + elif not dt_remote and dt_local: self.status = self.UPLOAD + else: + self.status = self.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") @@ -68,8 +72,8 @@ class CloudSaveDialog(QDialog, Ui_SyncSaveDialog): self.layout().setSizeConstraint(QLayout.SetFixedSize) def get_action(self): - if self.status: - return self.status + if self.status == self.SKIP: + return self.SKIP self.exec_() return self.status diff --git a/rare/game_launch_helper/__init__.py b/rare/game_launch_helper/__init__.py index 1e22611a..3a7db341 100644 --- a/rare/game_launch_helper/__init__.py +++ b/rare/game_launch_helper/__init__.py @@ -136,6 +136,8 @@ class RareLauncher(RareApp): self.core = LegendaryCore() self.args = args + self.no_sync_on_exit = False + game = self.core.get_game(self.app_name) self.rgame = RareGameSlim(self.core, game) @@ -201,19 +203,23 @@ class RareLauncher(RareApp): self.rgame.signals.widget.update.connect(lambda: self.on_exit(exit_code)) state, (dt_local, dt_remote) = self.rgame.save_game_state - if state == SaveGameStatus.LOCAL_NEWER: + + if state == SaveGameStatus.LOCAL_NEWER and not self.no_sync_on_exit: action = CloudSaveDialog.UPLOAD else: action = CloudSaveDialog(self.rgame.igame, dt_local, dt_remote).get_action() - if not action: - self.on_exit(exit_code) - return - if self.console: - self.console.log("Syncing saves...") + if action == CloudSaveDialog.UPLOAD: + if self.console: + self.console.log("upload saves...") self.rgame.upload_saves() elif action == CloudSaveDialog.DOWNLOAD: + if self.console: + self.console.log("Download saves...") self.rgame.download_saves() + else: + self.on_exit(exit_code) + def game_finished(self, exit_code): self.logger.info("Game finished") @@ -309,6 +315,8 @@ class RareLauncher(RareApp): _, (dt_local, dt_remote) = self.rgame.save_game_state dlg = CloudSaveDialog(self.rgame.igame, dt_local, dt_remote) action = dlg.get_action() + if action == CloudSaveDialog.CANCEL: + self.no_sync_on_exit = True if self.console: if action == CloudSaveDialog.DOWNLOAD: self.console.log("Downloading saves") diff --git a/rare/models/game.py b/rare/models/game.py index 25e87500..251c631a 100644 --- a/rare/models/game.py +++ b/rare/models/game.py @@ -546,7 +546,6 @@ class RareGame(RareGameSlim): skip_update_check: bool = False, wine_bin: Optional[str] = None, wine_pfx: Optional[str] = None, - ask_sync_saves: bool = False, ) -> bool: if not self.can_launch: return False @@ -562,8 +561,6 @@ class RareGame(RareGameSlim): args.extend(["--wine-bin", wine_bin]) if wine_pfx: args.extend(["--wine-prefix", wine_pfx]) - if ask_sync_saves: - args.extend("--ask-sync-saves") QProcess.startDetached(executable, args) logger.info(f"Start new Process: ({executable} {' '.join(args)})") diff --git a/rare/ui/components/tabs/games/game_info/sync_widget.py b/rare/ui/components/tabs/games/game_info/sync_widget.py index 0ac58239..fc7cdccf 100644 --- a/rare/ui/components/tabs/games/game_info/sync_widget.py +++ b/rare/ui/components/tabs/games/game_info/sync_widget.py @@ -14,7 +14,7 @@ from PyQt5 import QtCore, QtGui, QtWidgets class Ui_SyncWidget(object): def setupUi(self, SyncWidget): SyncWidget.setObjectName("SyncWidget") - SyncWidget.resize(422, 127) + SyncWidget.resize(438, 137) sizePolicy = QtWidgets.QSizePolicy(QtWidgets.QSizePolicy.Preferred, QtWidgets.QSizePolicy.Fixed) sizePolicy.setHorizontalStretch(0) sizePolicy.setVerticalStretch(0) @@ -44,6 +44,7 @@ class Ui_SyncWidget(object): self.icon_local.setObjectName("icon_local") self.local_layout.addWidget(self.icon_local) self.age_label_local = QtWidgets.QLabel(self.local_gb) + self.age_label_local.setText("") self.age_label_local.setAlignment(QtCore.Qt.AlignCenter) self.age_label_local.setObjectName("age_label_local") self.local_layout.addWidget(self.age_label_local) @@ -72,7 +73,7 @@ class Ui_SyncWidget(object): self.icon_remote.setObjectName("icon_remote") self.cloud_layout.addWidget(self.icon_remote) self.age_label_remote = QtWidgets.QLabel(self.cloud_gb) - self.age_label_remote.setText("remote_age_error") + self.age_label_remote.setText("") self.age_label_remote.setAlignment(QtCore.Qt.AlignCenter) self.age_label_remote.setObjectName("age_label_remote") self.cloud_layout.addWidget(self.age_label_remote) @@ -87,7 +88,6 @@ class Ui_SyncWidget(object): def retranslateUi(self, SyncWidget): _translate = QtCore.QCoreApplication.translate self.local_gb.setTitle(_translate("SyncWidget", "Local")) - self.age_label_local.setText(_translate("SyncWidget", "local_age_error")) self.upload_button.setText(_translate("SyncWidget", "Upload")) self.cloud_gb.setTitle(_translate("SyncWidget", "Cloud")) self.download_button.setText(_translate("SyncWidget", "Download")) diff --git a/rare/ui/components/tabs/games/game_info/sync_widget.ui b/rare/ui/components/tabs/games/game_info/sync_widget.ui index 9a499aa3..5c3b8090 100644 --- a/rare/ui/components/tabs/games/game_info/sync_widget.ui +++ b/rare/ui/components/tabs/games/game_info/sync_widget.ui @@ -6,8 +6,8 @@ 0 0 - 422 - 127 + 438 + 137 @@ -67,7 +67,7 @@ - local_age_error + Qt::AlignCenter @@ -125,7 +125,7 @@ - remote_age_error + Qt::AlignCenter