Merge branch 'develop' of ssh://code.ascee.nl:12001/ASCEE/lasp into develop

This commit is contained in:
Anne de Jong 2022-10-24 13:32:03 +02:00
commit bf854b4055

View File

@ -29,7 +29,7 @@ class DaqConfigurations:
output_config: DaqConfiguration, output_config: DaqConfiguration,
): ):
""" """
Initialize set of DaqConfigurations. Initialize set of DaqConfigurations.
Args: Args:
duplex_mode: If true, the input configuration is used for output as duplex_mode: If true, the input configuration is used for output as
@ -92,6 +92,18 @@ class DaqConfigurations:
output_config = DaqConfiguration.fromTOML(config_str[2]) output_config = DaqConfiguration.fromTOML(config_str[2])
return DaqConfigurations(duplex_mode, input_config, output_config) 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): def save(self, name: str):
""" """
Save the current set of configurations to the shelve store. 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] configs_str[name] = [self.duplex_mode, input_str, output_str]
sh.store(f"daqconfigs_v{LASP_VERSION_MAJOR}", configs_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 @staticmethod
def delete(name: str): def delete(name: str):
""" """