mirror of
https://git.mirrors.martin98.com/https://github.com/Ultimaker/Cura
synced 2025-08-20 01:09:06 +08:00
Fix backup causing a crash in specific situations
This commit is contained in:
parent
60488e9ff6
commit
186eef0b68
@ -51,8 +51,18 @@ class BackupsManager:
|
|||||||
## 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 as it might interfere with
|
||||||
# restoring a back-up.
|
# restoring a back-up.
|
||||||
def _disableAutoSave(self) -> None:
|
def _disableAutoSave(self) -> None:
|
||||||
self._application.getAutoSave().setEnabled(False)
|
auto_save = self._application.getAutoSave()
|
||||||
|
# The auto save is only not created if the application has not yet started.
|
||||||
|
if auto_save:
|
||||||
|
auto_save.setEnabled(False)
|
||||||
|
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 after we're done.
|
||||||
def _enableAutoSave(self) -> None:
|
def _enableAutoSave(self) -> None:
|
||||||
self._application.getAutoSave().setEnabled(True)
|
auto_save = self._application.getAutoSave()
|
||||||
|
# The auto save is only not created if the application has not yet started.
|
||||||
|
if auto_save:
|
||||||
|
auto_save.setEnabled(True)
|
||||||
|
else:
|
||||||
|
Logger.log("e", "Unable to enable the autosave as application init has not been completed")
|
||||||
|
@ -260,7 +260,7 @@ class CuraApplication(QtApplication):
|
|||||||
self._plugins_loaded = False
|
self._plugins_loaded = False
|
||||||
|
|
||||||
# Backups
|
# Backups
|
||||||
self._auto_save = None
|
self._auto_save = None # type: Optional[AutoSave]
|
||||||
|
|
||||||
from cura.Settings.CuraContainerRegistry import CuraContainerRegistry
|
from cura.Settings.CuraContainerRegistry import CuraContainerRegistry
|
||||||
self._container_registry_class = CuraContainerRegistry
|
self._container_registry_class = CuraContainerRegistry
|
||||||
@ -988,7 +988,7 @@ class CuraApplication(QtApplication):
|
|||||||
|
|
||||||
return super().event(event)
|
return super().event(event)
|
||||||
|
|
||||||
def getAutoSave(self):
|
def getAutoSave(self) -> Optional[AutoSave]:
|
||||||
return self._auto_save
|
return self._auto_save
|
||||||
|
|
||||||
## Get print information (duration / material used)
|
## Get print information (duration / material used)
|
||||||
|
Loading…
x
Reference in New Issue
Block a user