gui/state: implement backup state file for last successful load (#2538)

This commit is contained in:
Florian Agbuya 2024-08-20 16:39:24 +00:00 committed by GitHub
parent 83bf984216
commit 62afcdaaf6
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
2 changed files with 4 additions and 0 deletions

View File

@ -6,6 +6,7 @@ Release notes
ARTIQ-9 (Unreleased) ARTIQ-9 (Unreleased)
-------------------- --------------------
* GUI state files are now automatically backed up upon successful loading.
* Zotino monitoring in the dashboard now displays the values in volts. * Zotino monitoring in the dashboard now displays the values in volts.
* afws_client now uses the "happy eyeballs" algorithm (RFC 6555) for a faster and more * afws_client now uses the "happy eyeballs" algorithm (RFC 6555) for a faster and more
reliable connection to the server. reliable connection to the server.

View File

@ -1,6 +1,7 @@
import asyncio import asyncio
from collections import OrderedDict from collections import OrderedDict
import logging import logging
import shutil
from sipyco.asyncio_tools import TaskObject from sipyco.asyncio_tools import TaskObject
from sipyco import pyon from sipyco import pyon
@ -45,6 +46,8 @@ class StateManager(TaskObject):
logger.info("State database '%s' not found, using defaults", logger.info("State database '%s' not found, using defaults",
self.filename) self.filename)
return return
else:
shutil.copy2(self.filename, self.filename + ".backup")
# The state of one object may depend on the state of another, # The state of one object may depend on the state of another,
# e.g. the display state may create docks that are referenced in # e.g. the display state may create docks that are referenced in
# the area state. # the area state.