mirror of
https://git.mirrors.martin98.com/https://github.com/Ultimaker/Cura
synced 2025-08-12 03:49:00 +08:00
Fix: Definitions could be partly saved between backup restore and quit.
part of CURA-7325
This commit is contained in:
parent
0841124389
commit
3c50b78e68
@ -48,9 +48,10 @@ class BackupsManager:
|
||||
# We don't want to store the data at this point as that would override the just-restored backup.
|
||||
self._application.windowClosed(save_data = False)
|
||||
|
||||
## Here we try to disable the auto-save plug-in as it might interfere with
|
||||
## Here we try to disable the auto-save plug-in and other saving as it might interfere with
|
||||
# restoring a back-up.
|
||||
def _disableAutoSave(self) -> None:
|
||||
self._application.enableSave(False)
|
||||
auto_save = self._application.getAutoSave()
|
||||
# The auto save is only not created if the application has not yet started.
|
||||
if auto_save:
|
||||
@ -58,8 +59,9 @@ class BackupsManager:
|
||||
else:
|
||||
Logger.log("e", "Unable to disable the autosave as application init has not been completed")
|
||||
|
||||
## Re-enable auto-save after we're done.
|
||||
## Re-enable auto-save and other saving after we're done.
|
||||
def _enableAutoSave(self) -> None:
|
||||
self._application.enableSave(True)
|
||||
auto_save = self._application.getAutoSave()
|
||||
# The auto save is only not created if the application has not yet started.
|
||||
if auto_save:
|
||||
|
@ -242,6 +242,7 @@ class CuraApplication(QtApplication):
|
||||
|
||||
# Backups
|
||||
self._auto_save = None # type: Optional[AutoSave]
|
||||
self._enable_save = True
|
||||
|
||||
self._container_registry_class = CuraContainerRegistry
|
||||
# Redefined here in order to please the typing.
|
||||
@ -685,15 +686,20 @@ class CuraApplication(QtApplication):
|
||||
self._message_box_callback = None
|
||||
self._message_box_callback_arguments = []
|
||||
|
||||
def enableSave(self, enable: bool):
|
||||
self._enable_save = enable
|
||||
|
||||
# Cura has multiple locations where instance containers need to be saved, so we need to handle this differently.
|
||||
def saveSettings(self) -> None:
|
||||
if not self.started:
|
||||
if not self.started or not self._enable_save:
|
||||
# Do not do saving during application start or when data should not be saved on quit.
|
||||
return
|
||||
ContainerRegistry.getInstance().saveDirtyContainers()
|
||||
self.savePreferences()
|
||||
|
||||
def saveStack(self, stack):
|
||||
if not self._enable_save:
|
||||
return
|
||||
ContainerRegistry.getInstance().saveContainer(stack)
|
||||
|
||||
@pyqtSlot(str, result = QUrl)
|
||||
|
Loading…
x
Reference in New Issue
Block a user