mirror of
https://github.com/Ultimaker/Cura.git
synced 2025-10-10 15:27:53 -06:00
Turn CuraApplication::_onExit into public api as saveSettings
Since we need it for the autosave plugin Contributes to CURA-1615
This commit is contained in:
parent
79892daa5e
commit
bdc8fdf508
1 changed files with 11 additions and 3 deletions
|
@ -116,6 +116,7 @@ class CuraApplication(QtApplication):
|
|||
self._center_after_select = False
|
||||
self._camera_animation = None
|
||||
self._cura_actions = None
|
||||
self._started = False
|
||||
|
||||
self.getController().getScene().sceneChanged.connect(self.updatePlatformActivity)
|
||||
self.getController().toolOperationStopped.connect(self._onToolOperationStopped)
|
||||
|
@ -189,7 +190,7 @@ class CuraApplication(QtApplication):
|
|||
|
||||
JobQueue.getInstance().jobFinished.connect(self._onJobFinished)
|
||||
|
||||
self.applicationShuttingDown.connect(self._onExit)
|
||||
self.applicationShuttingDown.connect(self.saveSettings)
|
||||
|
||||
self._recent_files = []
|
||||
files = Preferences.getInstance().getValue("cura/recent_files").split(";")
|
||||
|
@ -199,8 +200,13 @@ class CuraApplication(QtApplication):
|
|||
|
||||
self._recent_files.append(QUrl.fromLocalFile(f))
|
||||
|
||||
## Cura has multiple locations where instance containers need to be saved, so we need to handle this differently.
|
||||
def _onExit(self):
|
||||
## 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
|
||||
return
|
||||
|
||||
for instance in ContainerRegistry.getInstance().findInstanceContainers():
|
||||
if not instance.isDirty():
|
||||
continue
|
||||
|
@ -332,6 +338,8 @@ class CuraApplication(QtApplication):
|
|||
for file_name in self._open_file_queue: #Open all the files that were queued up while plug-ins were loading.
|
||||
self._openFile(file_name)
|
||||
|
||||
self._started = True
|
||||
|
||||
self.exec_()
|
||||
|
||||
## Handle Qt events
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue