diff --git a/owrx/controllers/settings.py b/owrx/controllers/settings.py index 685f6e8..352f56d 100644 --- a/owrx/controllers/settings.py +++ b/owrx/controllers/settings.py @@ -19,6 +19,7 @@ from owrx.form import ( OptionalConverter, AprsBeaconSymbols, EnumConverter, + AprsAntennaDirections, ) from urllib.parse import quote from owrx.wsjt import Fst4Profile, Fst4wProfile @@ -297,7 +298,12 @@ class GeneralSettingsController(AdminController): append="dBi", converter=OptionalConverter(), ), - # TODO: aprs_igate_dir + DropdownInput( + "aprs_igate_dir", + "Antenna direction", + [o.toOption() for o in AprsAntennaDirections], + converter=EnumConverter(AprsAntennaDirections), + ), ), Section( "pskreporter settings", @@ -359,6 +365,10 @@ class GeneralSettingsController(AdminController): data = {k: v for i in GeneralSettingsController.sections for k, v in i.parse(data).items()} config = Config.get() for k, v in data.items(): - config[k] = v + if v is None: + if k in config: + del config[k] + else: + config[k] = v Config.store() self.send_redirect("/generalsettings") diff --git a/owrx/form/__init__.py b/owrx/form/__init__.py index 4cb87df..af529d3 100644 --- a/owrx/form/__init__.py +++ b/owrx/form/__init__.py @@ -365,3 +365,18 @@ class AprsBeaconSymbols(Enum): def toOption(self): return Option(self.name, "{description} ({symbol})".format(description=str(self), symbol=self.value)) + + +class AprsAntennaDirections(Enum): + DIRECTION_OMNI = None + DIRECTION_N = "N" + DIRECTION_NE = "NE" + DIRECTION_E = "E" + DIRECTION_SE = "SE" + DIRECTION_S = "S" + DIRECTION_SW = "SW" + DIRECTION_W = "W" + DIRECTION_NW = "NW" + + def toOption(self): + return Option(self.name, "omnidirectional" if self.value is None else self.value)