Add: DaqConfigurations.loadRaw() and saveRaw() for easy accessing of DAQ configuration data
This commit is contained in:
parent
6eaf5db691
commit
b259580736
@ -92,6 +92,18 @@ class DaqConfigurations:
|
||||
output_config = DaqConfiguration.fromTOML(config_str[2])
|
||||
return DaqConfigurations(duplex_mode, input_config, output_config)
|
||||
|
||||
@staticmethod
|
||||
def loadRaw():
|
||||
"""
|
||||
Returns configurations presets in the raw form they are stored.
|
||||
|
||||
Returns:
|
||||
all configurations, raw
|
||||
"""
|
||||
with lasp_shelve() as sh:
|
||||
configs_raw = sh.load(f"daqconfigs_v{LASP_VERSION_MAJOR}", {})
|
||||
return configs_raw
|
||||
|
||||
def save(self, name: str):
|
||||
"""
|
||||
Save the current set of configurations to the shelve store.
|
||||
@ -109,6 +121,17 @@ class DaqConfigurations:
|
||||
configs_str[name] = [self.duplex_mode, input_str, output_str]
|
||||
sh.store(f"daqconfigs_v{LASP_VERSION_MAJOR}", configs_str)
|
||||
|
||||
@staticmethod
|
||||
def saveRaw(configs_raw):
|
||||
"""
|
||||
Save configurations presets, using already formatted data
|
||||
|
||||
Arg:
|
||||
all configurations, raw data format in form they are stored
|
||||
"""
|
||||
with lasp_shelve() as sh:
|
||||
sh.store(f"daqconfigs_v{LASP_VERSION_MAJOR}", configs_raw)
|
||||
|
||||
@staticmethod
|
||||
def delete(name: str):
|
||||
"""
|
||||
|
Loading…
Reference in New Issue
Block a user