From c7db144f7bdba2486e319a39b74c8b8a563a18b1 Mon Sep 17 00:00:00 2001 From: Jakob Ketterl Date: Sun, 28 Feb 2021 21:26:55 +0100 Subject: [PATCH] add name input for profiles --- owrx/source/__init__.py | 15 +++++++++++---- 1 file changed, 11 insertions(+), 4 deletions(-) diff --git a/owrx/source/__init__.py b/owrx/source/__init__.py index e0d7e38..e325c33 100644 --- a/owrx/source/__init__.py +++ b/owrx/source/__init__.py @@ -475,9 +475,14 @@ class SdrDeviceDescription(object): except (ModuleNotFoundError, AttributeError): raise SdrDeviceDescriptionMissing("Device description for type {} not available".format(sdr_type)) + def getDeviceInputs(self) -> List[Input]: + return [TextInput("name", "Device name")] + self.getInputs() + + def getProfileInputs(self) -> List[Input]: + return [TextInput("name", "Profile name")] + self.getInputs() + def getInputs(self) -> List[Input]: return [ - TextInput("name", "Device name"), CheckboxInput("enabled", "Enable this device", converter=OptionalConverter(defaultFormValue=True)), GainInput("rf_gain", "Device gain", self.hasAgc()), NumberInput( @@ -529,18 +534,20 @@ class SdrDeviceDescription(object): ] def getProfileMandatoryKeys(self): - return ["center_freq", "samp_rate", "start_freq", "start_mod"] + return ["name", "center_freq", "samp_rate", "start_freq", "start_mod"] def getProfileOptionalKeys(self): return ["initial_squelch_level", "rf_gain", "lfo_offset", "waterfall_levels"] def getDeviceSection(self): - return OptionalSection("Device settings", self.getInputs(), self.getMandatoryKeys(), self.getOptionalKeys()) + return OptionalSection( + "Device settings", self.getDeviceInputs(), self.getMandatoryKeys(), self.getOptionalKeys() + ) def getProfileSection(self): return OptionalSection( "Profile settings", - self.getInputs(), + self.getProfileInputs(), self.getProfileMandatoryKeys(), self.getProfileOptionalKeys(), )