mirror of
https://github.com/Ultimaker/Cura.git
synced 2025-07-06 22:47:29 -06:00
Also wait for lock file in saveSettings. CURA-2449
This commit is contained in:
parent
fc0417bd45
commit
83caa334a2
1 changed files with 9 additions and 3 deletions
|
@ -236,9 +236,7 @@ class CuraApplication(QtApplication):
|
||||||
|
|
||||||
# Set the filename to create if cura is writing in the config dir.
|
# Set the filename to create if cura is writing in the config dir.
|
||||||
self._config_lock_filename = os.path.join(Resources.getConfigStoragePath(), CONFIG_LOCK_FILENAME)
|
self._config_lock_filename = os.path.join(Resources.getConfigStoragePath(), CONFIG_LOCK_FILENAME)
|
||||||
# Lock file check: if (another) Cura is writing in the Config dir, one may not be able to read a
|
self.waitConfigLockFile()
|
||||||
# valid set of files. Not entirely fool-proof, but works when you start Cura shortly after shutting down.
|
|
||||||
waitFileDisappear(self._config_lock_filename, max_age_seconds=10, msg="Waiting for Cura to finish writing in the config dir...")
|
|
||||||
ContainerRegistry.getInstance().load()
|
ContainerRegistry.getInstance().load()
|
||||||
|
|
||||||
Preferences.getInstance().addPreference("cura/active_mode", "simple")
|
Preferences.getInstance().addPreference("cura/active_mode", "simple")
|
||||||
|
@ -319,6 +317,12 @@ class CuraApplication(QtApplication):
|
||||||
|
|
||||||
self._recent_files.append(QUrl.fromLocalFile(f))
|
self._recent_files.append(QUrl.fromLocalFile(f))
|
||||||
|
|
||||||
|
## Lock file check: if (another) Cura is writing in the Config dir.
|
||||||
|
# one may not be able to read a valid set of files while writing. Not entirely fool-proof,
|
||||||
|
# but works when you start Cura shortly after shutting down.
|
||||||
|
def waitConfigLockFile(self):
|
||||||
|
waitFileDisappear(self._config_lock_filename, max_age_seconds=10, msg="Waiting for Cura to finish writing in the config dir...")
|
||||||
|
|
||||||
def _onEngineCreated(self):
|
def _onEngineCreated(self):
|
||||||
self._engine.addImageProvider("camera", CameraImageProvider.CameraImageProvider())
|
self._engine.addImageProvider("camera", CameraImageProvider.CameraImageProvider())
|
||||||
|
|
||||||
|
@ -346,6 +350,8 @@ class CuraApplication(QtApplication):
|
||||||
if not self._started: # Do not do saving during application start
|
if not self._started: # Do not do saving during application start
|
||||||
return
|
return
|
||||||
|
|
||||||
|
self.waitConfigLockFile()
|
||||||
|
|
||||||
# When starting Cura, we check for the lockFile which is created and deleted here
|
# When starting Cura, we check for the lockFile which is created and deleted here
|
||||||
with lockFile(self._config_lock_filename):
|
with lockFile(self._config_lock_filename):
|
||||||
|
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue