diff options
author | Konstantinos Karmas <konskarm@gmail.com> | 2021-06-25 10:22:12 +0300 |
---|---|---|
committer | Konstantinos Karmas <konskarm@gmail.com> | 2021-06-25 10:22:12 +0300 |
commit | 4435a10f9d53c7758d1ea5ed93aa820488f1eda8 (patch) | |
tree | 0665f2e65fe1a8408e0e60b9259af1487fadfdd4 /cura/Backups | |
parent | 9a27a63b7e650de0b164e7e7788387c16ff46d1e (diff) |
Revert "Show warning when restoring backup failed"
We decided to add the warning message in a separate ticket for 4.11.
This reverts commit 584a387debec75023094db6cba84a8bf1781d6ea.
Diffstat (limited to 'cura/Backups')
-rw-r--r-- | cura/Backups/Backup.py | 17 |
1 files changed, 5 insertions, 12 deletions
diff --git a/cura/Backups/Backup.py b/cura/Backups/Backup.py index 3568369201..1f6a961733 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, List, Tuple +from typing import Dict, Optional, TYPE_CHECKING, List from UM import i18nCatalog from UM.Logger import Logger @@ -156,10 +156,7 @@ class Backup: Logger.log("d", f"The following error occurred while trying to restore a Cura backup: {str(e)}") self._showMessage(self.catalog.i18nc("@info:backup_failed", "The following error occurred while trying to restore a Cura backup:") + str(e)) return False - extracted, failed_files = self._extractArchive(archive, version_data_dir) - self._showMessage( - self.catalog.i18nc("@info:backup_failed", - "The following error occurred while trying to restore a Cura backup:" + "\n{}".format("\n".join(failed_files)))) + extracted = self._extractArchive(archive, version_data_dir) # Under Linux, preferences are stored elsewhere, so we copy the file to there. if Platform.isLinux(): @@ -178,7 +175,7 @@ class Backup: return extracted @staticmethod - def _extractArchive(archive: "ZipFile", target_path: str) -> Tuple[bool, List[str]]: + def _extractArchive(archive: "ZipFile", target_path: str) -> bool: """Extract the whole archive to the given target path. :param archive: The archive as ZipFile. @@ -191,23 +188,19 @@ class Backup: config_filename = CuraApplication.getInstance().getApplicationName() + ".cfg" # Should be there if valid. if config_filename not in [file.filename for file in archive.filelist]: Logger.logException("e", "Unable to extract the backup due to corruption of compressed file(s).") - return False, [] + return False Logger.log("d", "Removing current data in location: %s", target_path) Resources.factoryReset() Logger.log("d", "Extracting backup to location: %s", target_path) name_list = archive.namelist() - failed_files = [] - full_restore = True for archive_filename in name_list: try: archive.extract(archive_filename, target_path) except (PermissionError, EnvironmentError): Logger.logException("e", f"Unable to extract the file {archive_filename} from the backup due to permission or file system errors.") - failed_files.append(archive_filename) - full_restore = False CuraApplication.getInstance().processEvents() - return full_restore, failed_files + return True def _obfuscate(self) -> Dict[str, str]: """ |