Skip to content

Commit

Permalink
fix auto sync saves
Browse files Browse the repository at this point in the history
  • Loading branch information
Dummerle committed Mar 19, 2023
1 parent 3874fac commit 554d355
Show file tree
Hide file tree
Showing 5 changed files with 13 additions and 10 deletions.
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -23,3 +23,4 @@ __pycache__
/rare.bin
/rare.cmd
/rare.exe
/poetry.lock
6 changes: 3 additions & 3 deletions rare/components/tabs/games/game_info/cloud_saves.py
Original file line number Diff line number Diff line change
Expand Up @@ -188,9 +188,9 @@ def __update_widget(self):
self.sync_ui.download_button.setDisabled(button_disabled)
self.sync_ui.upload_button.setDisabled(button_disabled)

self.cloud_ui.cloud_sync.setChecked(
self.settings.value(f"{self.rgame.app_name}/auto_sync_cloud", False, bool)
)
self.cloud_ui.cloud_sync.blockSignals(True)
self.cloud_ui.cloud_sync.setChecked(self.rgame.auto_sync_saves)
self.cloud_ui.cloud_sync.blockSignals(False)
self.cloud_save_path_edit.setText(self.rgame.save_path if self.rgame.save_path else "")

def update_game(self, rgame: RareGame):
Expand Down
2 changes: 1 addition & 1 deletion rare/components/tabs/settings/rare.py
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,7 @@ def __init__(self, parent=None):
(self.sys_tray, "sys_tray", True),
(self.auto_update, "auto_update", False),
(self.confirm_start, "confirm_start", False),
(self.auto_sync_cloud, "auto_sync_cloud", True),
(self.auto_sync_cloud, "auto_sync_cloud", False),
(self.notification, "notification", True),
(self.save_size, "save_size", False),
(self.log_games, "show_console", False),
Expand Down
2 changes: 1 addition & 1 deletion rare/game_launch_helper/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -218,7 +218,7 @@ def check_saves_finished(self, exit_code: int):
def game_finished(self, exit_code):
self.logger.info("Game finished")

if self.rgame.supports_cloud_saves:
if self.rgame.auto_sync_saves:
self.check_saves_finished(exit_code)
else:
self.on_exit(exit_code)
Expand Down
12 changes: 7 additions & 5 deletions rare/models/base_game.py
Original file line number Diff line number Diff line change
Expand Up @@ -161,9 +161,11 @@ def is_win32(self) -> bool:

@property
def auto_sync_saves(self):
return (
self.game.supports_cloud_saves or self.game.supports_mac_cloud_saves
) and QSettings().value(f"{self.app_name}/auto_sync_cloud", True, bool)
return self.supports_cloud_saves and QSettings().value(
f"{self.app_name}/auto_sync_cloud",
QSettings().value("auto_sync_cloud", False, bool),
bool
)

@property
def save_path(self) -> Optional[str]:
Expand Down Expand Up @@ -200,7 +202,7 @@ def _upload():
self.state = RareGameSlim.State.IDLE
self.update_saves()

if not self.game.supports_cloud_saves and not self.game.supports_mac_cloud_saves:
if not self.supports_cloud_saves:
return
if status == SaveGameStatus.NO_SAVE or not dt_local:
logger.warning("Can't upload non existing save")
Expand All @@ -225,7 +227,7 @@ def _download():
self.state = RareGameSlim.State.IDLE
self.update_saves()

if not self.game.supports_cloud_saves and not self.game.supports_mac_cloud_saves:
if not self.supports_cloud_saves:
return
if status == SaveGameStatus.NO_SAVE or not dt_remote:
logger.error("Can't download non existing save")
Expand Down

0 comments on commit 554d355

Please sign in to comment.