From 809cab4ea55795fec01070a36d8d79b07ec30312 Mon Sep 17 00:00:00 2001 From: ChrisTerBeke Date: Wed, 23 May 2018 19:18:11 +0200 Subject: [PATCH] Cleanup for cfd1b7b813ccdac76c623243a03633b2059d9a0e --- cura/Backups/Backup.py | 1 - cura/Backups/BackupsManager.py | 10 +++++----- cura/CuraApplication.py | 5 +---- resources/bundled_packages.json | 17 ----------------- 4 files changed, 6 insertions(+), 27 deletions(-) diff --git a/cura/Backups/Backup.py b/cura/Backups/Backup.py index 89a3a54b59..c4fe720b2b 100644 --- a/cura/Backups/Backup.py +++ b/cura/Backups/Backup.py @@ -14,7 +14,6 @@ from UM.Logger import Logger from UM.Message import Message from UM.Platform import Platform from UM.Resources import Resources -from UM.Version import Version from cura.CuraApplication import CuraApplication diff --git a/cura/Backups/BackupsManager.py b/cura/Backups/BackupsManager.py index 38ffcac92b..fa75ddb587 100644 --- a/cura/Backups/BackupsManager.py +++ b/cura/Backups/BackupsManager.py @@ -12,6 +12,8 @@ class BackupsManager: The BackupsManager is responsible for managing the creating and restoring of backups. Backups themselves are represented in a different class. """ + def __init__(self): + self._application = CuraApplication.getInstance() def createBackup(self) -> (Optional[bytes], Optional[dict]): """ @@ -43,14 +45,12 @@ class BackupsManager: 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. - CuraApplication.getInstance().windowClosed(save_data=False) + self._application.windowClosed(save_data=False) def _disableAutoSave(self): """Here we try to disable the auto-save plugin as it might interfere with restoring a backup.""" - # TODO: Disable auto-save if possible. - CuraApplication.getInstance().setSaveDataEnabled(False) + self._application.setSaveDataEnabled(False) def _enableAutoSave(self): """Re-enable auto-save after we're done.""" - # TODO: Enable auto-save if possible. - CuraApplication.getInstance().setSaveDataEnabled(True) + self._application.setSaveDataEnabled(True) diff --git a/cura/CuraApplication.py b/cura/CuraApplication.py index c1c52c42bf..5db616ab3b 100755 --- a/cura/CuraApplication.py +++ b/cura/CuraApplication.py @@ -503,15 +503,12 @@ class CuraApplication(QtApplication): def setSaveDataEnabled(self, enabled: bool) -> None: self._save_data_enabled = enabled - ## Cura has multiple locations where instance containers need to be saved, so we need to handle this differently. - # - # Note that the AutoSave plugin also calls this method. + # Cura has multiple locations where instance containers need to be saved, so we need to handle this differently. def saveSettings(self): if not self.started or not self._save_data_enabled: # Do not do saving during application start or when data should not be safed on quit. return ContainerRegistry.getInstance().saveDirtyContainers() - Preferences.getInstance().writeToFile(Resources.getStoragePath(Resources.Preferences, self._application_name + ".cfg")) diff --git a/resources/bundled_packages.json b/resources/bundled_packages.json index 8d58f226b0..a63d08ddab 100644 --- a/resources/bundled_packages.json +++ b/resources/bundled_packages.json @@ -33,23 +33,6 @@ } } }, - "AutoSave": { - "package_info": { - "package_id": "AutoSave", - "package_type": "plugin", - "display_name": "Auto-Save", - "description": "Automatically saves Preferences, Machines and Profiles after changes.", - "package_version": "1.0.0", - "cura_version": 4, - "website": "https://ultimaker.com", - "author": { - "author_id": "Ultimaker", - "display_name": "Ultimaker B.V.", - "email": "plugins@ultimaker.com", - "website": "https://ultimaker.com" - } - } - }, "ChangeLogPlugin": { "package_info": { "package_id": "ChangeLogPlugin",