include changed wsjt keys in config migration
This commit is contained in:
parent
e557d46c0d
commit
048aab682f
@ -26,6 +26,11 @@ class ConfigMigrator(ABC):
|
|||||||
def migrate(self, config):
|
def migrate(self, config):
|
||||||
pass
|
pass
|
||||||
|
|
||||||
|
def renameKey(self, config, old, new):
|
||||||
|
if old in config and not new in config:
|
||||||
|
config[new] = config[old]
|
||||||
|
del config[old]
|
||||||
|
|
||||||
|
|
||||||
class ConfigMigratorVersion1(ConfigMigrator):
|
class ConfigMigratorVersion1(ConfigMigrator):
|
||||||
def migrate(self, config):
|
def migrate(self, config):
|
||||||
@ -37,6 +42,9 @@ class ConfigMigratorVersion1(ConfigMigrator):
|
|||||||
levels = config["waterfall_auto_level_margin"]
|
levels = config["waterfall_auto_level_margin"]
|
||||||
config["waterfall_auto_level_margin"] = {"min": levels[0], "max": levels[1]}
|
config["waterfall_auto_level_margin"] = {"min": levels[0], "max": levels[1]}
|
||||||
|
|
||||||
|
self.renameKey(config, "wsjt_queue_workers", "decoding_queue_workers")
|
||||||
|
self.renameKey(config, "wsjt_queue_length", "decoding_queue_length")
|
||||||
|
|
||||||
config["version"] = 2
|
config["version"] = 2
|
||||||
return config
|
return config
|
||||||
|
|
||||||
|
@ -40,6 +40,10 @@ class PropertyManager(ABC):
|
|||||||
def __dict__(self):
|
def __dict__(self):
|
||||||
pass
|
pass
|
||||||
|
|
||||||
|
@abstractmethod
|
||||||
|
def __delitem__(self, key):
|
||||||
|
pass
|
||||||
|
|
||||||
@abstractmethod
|
@abstractmethod
|
||||||
def keys(self):
|
def keys(self):
|
||||||
pass
|
pass
|
||||||
@ -98,6 +102,9 @@ class PropertyLayer(PropertyManager):
|
|||||||
def __dict__(self):
|
def __dict__(self):
|
||||||
return {k: v for k, v in self.properties.items()}
|
return {k: v for k, v in self.properties.items()}
|
||||||
|
|
||||||
|
def __delitem__(self, key):
|
||||||
|
return self.properties.__delitem__(key)
|
||||||
|
|
||||||
def keys(self):
|
def keys(self):
|
||||||
return self.properties.keys()
|
return self.properties.keys()
|
||||||
|
|
||||||
@ -132,6 +139,11 @@ class PropertyFilter(PropertyManager):
|
|||||||
def __dict__(self):
|
def __dict__(self):
|
||||||
return {k: v for k, v in self.pm.__dict__().items() if k in self.props}
|
return {k: v for k, v in self.pm.__dict__().items() if k in self.props}
|
||||||
|
|
||||||
|
def __delitem__(self, key):
|
||||||
|
if key not in self.props:
|
||||||
|
raise KeyError(key)
|
||||||
|
return self.pm.__delitem__(key)
|
||||||
|
|
||||||
def keys(self):
|
def keys(self):
|
||||||
return [k for k in self.pm.keys() if k in self.props]
|
return [k for k in self.pm.keys() if k in self.props]
|
||||||
|
|
||||||
@ -226,5 +238,9 @@ class PropertyStack(PropertyManager):
|
|||||||
def __dict__(self):
|
def __dict__(self):
|
||||||
return {k: self.__getitem__(k) for k in self.keys()}
|
return {k: self.__getitem__(k) for k in self.keys()}
|
||||||
|
|
||||||
|
def __delitem__(self, key):
|
||||||
|
for layer in self.layers:
|
||||||
|
layer["props"].__delitem__(key)
|
||||||
|
|
||||||
def keys(self):
|
def keys(self):
|
||||||
return set([key for l in self.layers for key in l["props"].keys()])
|
return set([key for l in self.layers for key in l["props"].keys()])
|
||||||
|
Loading…
Reference in New Issue
Block a user