From fa690a0f5e3044dd114b420cfd04a240e0a38c30 Mon Sep 17 00:00:00 2001 From: Jaime van Kessel Date: Wed, 16 Jun 2021 13:51:09 +0200 Subject: [PATCH 1/3] Fix issue with restoring backups from 4.10 There were some cases where issues could occur due to plugins no longer being there CURA-8313 --- cura/Backups/BackupsManager.py | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/cura/Backups/BackupsManager.py b/cura/Backups/BackupsManager.py index 6d620b8d27..c69ff4cfd4 100644 --- a/cura/Backups/BackupsManager.py +++ b/cura/Backups/BackupsManager.py @@ -55,14 +55,16 @@ class BackupsManager: restored = backup.restore() package_manager = self._application.getPackageManager() + # Load the new version of the package manager data. + package_manager.loadManagementData() # If the backup was made with Cura 4.10 (or higher), we no longer store plugins. # Since the restored backup doesn't have those plugins anymore, we should remove it from the list # of installed plugins. if Version(meta_data.get("cura_release")) >= Version("4.10.0"): - for package_id in package_manager.getAllInstalledPackageIDs(): + for package_id in package_manager.getInstalledPackageIDs(): package_data = package_manager.getInstalledPackageInfo(package_id) - if package_data.get("package_type") == "plugin" and not package_data.get("is_bundled"): + if package_data.get("package_type") == "plugin": package_manager.removePackage(package_id) if restored: From 40a981b9026e3c53b748787b70c28aa60491675c Mon Sep 17 00:00:00 2001 From: Jaime van Kessel Date: Thu, 17 Jun 2021 15:36:45 +0200 Subject: [PATCH 2/3] Re-enable the backing up of plugins Because we're adding a messgae for the user if the loading of a plugin failed (which can happen after backing up a plugin in central storage), we can re-enable the backing up of plugins again. CURA-8313 --- cura/Backups/Backup.py | 2 +- cura/Backups/BackupsManager.py | 13 ------------- 2 files changed, 1 insertion(+), 14 deletions(-) diff --git a/cura/Backups/Backup.py b/cura/Backups/Backup.py index d9f1788744..81d7caa295 100644 --- a/cura/Backups/Backup.py +++ b/cura/Backups/Backup.py @@ -29,7 +29,7 @@ class Backup: IGNORED_FILES = [r"cura\.log", r"plugins\.json", r"cache", r"__pycache__", r"\.qmlc", r"\.pyc"] """These files should be ignored when making a backup.""" - IGNORED_FOLDERS = [r"plugins"] + IGNORED_FOLDERS = [] SECRETS_SETTINGS = ["general/ultimaker_auth_data"] """Secret preferences that need to obfuscated when making a backup of Cura""" diff --git a/cura/Backups/BackupsManager.py b/cura/Backups/BackupsManager.py index c69ff4cfd4..6c4670edb6 100644 --- a/cura/Backups/BackupsManager.py +++ b/cura/Backups/BackupsManager.py @@ -54,19 +54,6 @@ class BackupsManager: backup = Backup(self._application, zip_file = zip_file, meta_data = meta_data) restored = backup.restore() - package_manager = self._application.getPackageManager() - # Load the new version of the package manager data. - package_manager.loadManagementData() - - # If the backup was made with Cura 4.10 (or higher), we no longer store plugins. - # Since the restored backup doesn't have those plugins anymore, we should remove it from the list - # of installed plugins. - if Version(meta_data.get("cura_release")) >= Version("4.10.0"): - for package_id in package_manager.getInstalledPackageIDs(): - package_data = package_manager.getInstalledPackageInfo(package_id) - if package_data.get("package_type") == "plugin": - package_manager.removePackage(package_id) - if restored: # At this point, Cura will need to restart for the changes to take effect. # We don't want to store the data at this point as that would override the just-restored backup. From ee16f61d65871063f63b09f38987f6e914887bb3 Mon Sep 17 00:00:00 2001 From: Jaime van Kessel Date: Thu, 17 Jun 2021 16:21:01 +0200 Subject: [PATCH 3/3] Add missing typing CURA-8313 --- cura/Backups/Backup.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/cura/Backups/Backup.py b/cura/Backups/Backup.py index 81d7caa295..5fad2ccf19 100644 --- a/cura/Backups/Backup.py +++ b/cura/Backups/Backup.py @@ -7,7 +7,7 @@ import re import shutil from copy import deepcopy from zipfile import ZipFile, ZIP_DEFLATED, BadZipfile -from typing import Dict, Optional, TYPE_CHECKING +from typing import Dict, Optional, TYPE_CHECKING, List from UM import i18nCatalog from UM.Logger import Logger @@ -29,7 +29,7 @@ class Backup: IGNORED_FILES = [r"cura\.log", r"plugins\.json", r"cache", r"__pycache__", r"\.qmlc", r"\.pyc"] """These files should be ignored when making a backup.""" - IGNORED_FOLDERS = [] + IGNORED_FOLDERS = [] # type: List[str] SECRETS_SETTINGS = ["general/ultimaker_auth_data"] """Secret preferences that need to obfuscated when making a backup of Cura"""