fix storing profiles

This commit is contained in:
Jakob Ketterl 2021-02-23 18:41:49 +01:00
parent c5df6a1527
commit 4e32d724c4

View File

@ -62,15 +62,16 @@ class SdrFormController(SettingsFormController, metaclass=ABCMeta):
# need to overwrite the existing key in the config since the layering won't capture the changes otherwise # need to overwrite the existing key in the config since the layering won't capture the changes otherwise
config = Config.get() config = Config.get()
sdrs = config["sdrs"] sdrs = config["sdrs"]
sdrs[self.device_id] = self.getData() sdrs[self.device_id] = self.device
config["sdrs"] = sdrs config["sdrs"] = sdrs
super().store() super().store()
def _get_device(self): def _get_device(self):
config = Config.get()
device_id = unquote(self.request.matches.group(1)) device_id = unquote(self.request.matches.group(1))
if device_id not in Config.get()["sdrs"]: if device_id not in config["sdrs"]:
return None return None
return device_id, Config.get()["sdrs"][device_id] return device_id, config["sdrs"][device_id]
class SdrDeviceController(SdrFormController): class SdrDeviceController(SdrFormController):
@ -137,12 +138,12 @@ class SdrProfileController(SdrFormController):
return self.profile return self.profile
def _get_profile(self): def _get_profile(self):
if self.device is None:
return None
profile_id = unquote(self.request.matches.group(2)) profile_id = unquote(self.request.matches.group(2))
if self.device_id not in Config.get()["sdrs"]: if profile_id not in self.device["profiles"]:
return None return None
if profile_id not in Config.get()["sdrs"][self.device_id]["profiles"]: return profile_id, self.device["profiles"][profile_id]
return None
return profile_id, Config.get()["sdrs"][self.device_id]["profiles"][profile_id]
def getSections(self): def getSections(self):
try: try: