add aprs_igate_dir option

This commit is contained in:
Jakob Ketterl 2021-02-08 01:00:00 +01:00
parent 4758672c94
commit 5cfacac6c0
2 changed files with 27 additions and 2 deletions

View File

@ -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():
if v is None:
if k in config:
del config[k]
else:
config[k] = v
Config.store()
self.send_redirect("/generalsettings")

View File

@ -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)