From 7c72e842150dc99c534b95731ecb6b67fd96ae09 Mon Sep 17 00:00:00 2001 From: Konstantinos Karmas Date: Tue, 22 Jun 2021 15:16:13 +0200 Subject: [PATCH] Read preferences from new restored configs Before calling the illuminate, we need to make sure that the previous cached Preferences have been overridden by the newly restored preferences from the backup. Otherwise, the `illuminate()` function will bring back the cached preferences and the new ones from the backup will be lost. CURA-8313 --- cura/Backups/Backup.py | 3 +++ plugins/CuraDrive/src/DriveApiService.py | 2 +- 2 files changed, 4 insertions(+), 1 deletion(-) diff --git a/cura/Backups/Backup.py b/cura/Backups/Backup.py index 5fad2ccf19..74ef43f5b2 100644 --- a/cura/Backups/Backup.py +++ b/cura/Backups/Backup.py @@ -166,6 +166,9 @@ class Backup: Logger.log("d", "Moving preferences file from %s to %s", backup_preferences_file, preferences_file) shutil.move(backup_preferences_file, preferences_file) + # Read the preferences from the newly restored configuration (or else the cached Preferences will override the restored ones) + self._application.readPreferencesFromConfiguration() + # Restore the obfuscated settings self._illuminate(**secrets) diff --git a/plugins/CuraDrive/src/DriveApiService.py b/plugins/CuraDrive/src/DriveApiService.py index 754069dc9b..6dd6f02b97 100644 --- a/plugins/CuraDrive/src/DriveApiService.py +++ b/plugins/CuraDrive/src/DriveApiService.py @@ -93,7 +93,7 @@ class DriveApiService: def _onRestoreFinished(self, job: "RestoreBackupJob") -> None: if job.restore_backup_error_message != "": # If the job contains an error message we pass it along so the UI can display it. - self.restoringStateChanged.emit(is_restoring=False) + self.restoringStateChanged.emit(is_restoring = False) else: self.restoringStateChanged.emit(is_restoring = False, error_message = job.restore_backup_error_message)