mirror of
https://git.mirrors.martin98.com/https://github.com/Ultimaker/Cura
synced 2025-04-23 14:19:37 +08:00
Do not safe data after restoring backup
This commit is contained in:
parent
79cebca9f0
commit
a7342f4619
@ -34,6 +34,9 @@ class Backup:
|
|||||||
|
|
||||||
Logger.log("d", "Creating backup for Cura %s, using folder %s", cura_release, version_data_dir)
|
Logger.log("d", "Creating backup for Cura %s, using folder %s", cura_release, version_data_dir)
|
||||||
|
|
||||||
|
# Ensure all current settings are saved.
|
||||||
|
CuraApplication.getInstance().saveSettings()
|
||||||
|
|
||||||
# We're using an easy to parse filename for when we're restoring edge cases:
|
# We're using an easy to parse filename for when we're restoring edge cases:
|
||||||
# TIMESTAMP.backup.VERSION.cura.zip
|
# TIMESTAMP.backup.VERSION.cura.zip
|
||||||
archive = self._makeArchive(version_data_dir)
|
archive = self._makeArchive(version_data_dir)
|
||||||
|
@ -44,7 +44,8 @@ class BackupsManager:
|
|||||||
restored = backup.restore()
|
restored = backup.restore()
|
||||||
if restored:
|
if restored:
|
||||||
# At this point, Cura will need to restart for the changes to take effect.
|
# At this point, Cura will need to restart for the changes to take effect.
|
||||||
CuraApplication.getInstance().windowClosed()
|
# We don't want to store the data at this point as that would override the just-restored backup.
|
||||||
|
CuraApplication.getInstance().windowClosed(safe_data=False)
|
||||||
|
|
||||||
def _disableAutoSave(self):
|
def _disableAutoSave(self):
|
||||||
"""Here we try to disable the auto-save plugin as it might interfere with restoring a backup."""
|
"""Here we try to disable the auto-save plugin as it might interfere with restoring a backup."""
|
||||||
|
@ -497,10 +497,10 @@ class CuraApplication(QtApplication):
|
|||||||
## Cura has multiple locations where instance containers need to be saved, so we need to handle this differently.
|
## 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.
|
# Note that the AutoSave plugin also calls this method.
|
||||||
def saveSettings(self):
|
def saveSettings(self, safe_data: bool = True):
|
||||||
if not self.started: # Do not do saving during application start
|
if not self.started or not safe_data:
|
||||||
|
# Do not do saving during application start or when data should not be safed on quit.
|
||||||
return
|
return
|
||||||
|
|
||||||
ContainerRegistry.getInstance().saveDirtyContainers()
|
ContainerRegistry.getInstance().saveDirtyContainers()
|
||||||
|
|
||||||
def saveStack(self, stack):
|
def saveStack(self, stack):
|
||||||
|
Loading…
x
Reference in New Issue
Block a user