mirror of
https://github.com/Ultimaker/Cura.git
synced 2025-11-22 10:21:39 -07:00
Merge pull request #3786 from Ultimaker/feature-backup-manager
Backup Manager and API
This commit is contained in:
commit
44b046e401
12 changed files with 309 additions and 56 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
|
||||
|
||||
|
|
@ -497,15 +500,21 @@ 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):
|
||||
if not self.started: # Do not do saving during application start
|
||||
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"))
|
||||
|
||||
def saveStack(self, stack):
|
||||
ContainerRegistry.getInstance().saveContainer(stack)
|
||||
|
||||
|
|
@ -726,6 +735,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):
|
||||
|
|
@ -877,6 +889,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