mirror of
https://github.com/Ultimaker/Cura.git
synced 2025-11-02 20:52:20 -07:00
Fix AutoSave conflicts with BackupManager
- Move AutoSave out of the plugins. It's a built-in module now. - Add enable/disable saving data on CuraApplication. - Avoid saving data in backup restore
This commit is contained in:
parent
41aa31cb2d
commit
cfd1b7b813
5 changed files with 22 additions and 51 deletions
|
|
@ -74,6 +74,7 @@ from cura.Settings.SimpleModeSettingsManager import SimpleModeSettingsManager
|
|||
|
||||
from cura.Machines.VariantManager import VariantManager
|
||||
|
||||
from .AutoSave import AutoSave
|
||||
from . import PlatformPhysics
|
||||
from . import BuildVolume
|
||||
from . import CameraAnimation
|
||||
|
|
@ -234,6 +235,8 @@ class CuraApplication(QtApplication):
|
|||
self._simple_mode_settings_manager = None
|
||||
self._cura_scene_controller = None
|
||||
self._machine_error_checker = None
|
||||
self._auto_save = None
|
||||
self._save_data_enabled = True
|
||||
|
||||
self._additional_components = {} # Components to add to certain areas in the interface
|
||||
|
||||
|
|
@ -496,11 +499,14 @@ class CuraApplication(QtApplication):
|
|||
|
||||
showPrintMonitor = pyqtSignal(bool, arguments = ["show"])
|
||||
|
||||
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.
|
||||
def saveSettings(self, safe_data: bool = True):
|
||||
if not self.started or not safe_data:
|
||||
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()
|
||||
|
|
@ -728,6 +734,9 @@ class CuraApplication(QtApplication):
|
|||
self._post_start_timer.timeout.connect(self._onPostStart)
|
||||
self._post_start_timer.start()
|
||||
|
||||
self._auto_save = AutoSave(self)
|
||||
self._auto_save.initialize()
|
||||
|
||||
self.exec_()
|
||||
|
||||
def _onPostStart(self):
|
||||
|
|
@ -879,6 +888,9 @@ class CuraApplication(QtApplication):
|
|||
|
||||
return super().event(event)
|
||||
|
||||
def getAutoSave(self):
|
||||
return self._auto_save
|
||||
|
||||
## Get print information (duration / material used)
|
||||
def getPrintInformation(self):
|
||||
return self._print_information
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue