This commit is contained in:
Jakob Ketterl 2020-03-29 19:52:56 +02:00
parent 199dfe106a
commit 65a0320cea

View File

@ -110,6 +110,13 @@ class CheckboxInput(Input):
return {self.id: self.id in data and data[self.id][0] == "on"} return {self.id: self.id in data and data[self.id][0] == "on"}
class Option(object):
# used for both MultiCheckboxInput and DropdownInput
def __init__(self, value, text):
self.value = value
self.text = text
class MultiCheckboxInput(Input): class MultiCheckboxInput(Input):
def __init__(self, id, label, options, infotext=None): def __init__(self, id, label, options, infotext=None):
super().__init__(id, label, infotext=infotext) super().__init__(id, label, infotext=infotext)
@ -148,16 +155,10 @@ class MultiCheckboxInput(Input):
class ServicesCheckboxInput(MultiCheckboxInput): class ServicesCheckboxInput(MultiCheckboxInput):
def __init__(self, id, label, infotext=None): def __init__(self, id, label, infotext=None):
services = [DropdownOption(s, s.upper()) for s in ServiceDetector.getAvailableServices()] services = [Option(s, s.upper()) for s in ServiceDetector.getAvailableServices()]
super().__init__(id, label, services, infotext) super().__init__(id, label, services, infotext)
class DropdownOption(object):
def __init__(self, value, text):
self.value = value
self.text = text
class DropdownInput(Input): class DropdownInput(Input):
def __init__(self, id, label, options, infotext = None): def __init__(self, id, label, options, infotext = None):
super().__init__(id, label, infotext=infotext) super().__init__(id, label, infotext=infotext)
@ -237,12 +238,12 @@ class SettingsController(AdminController):
Section( Section(
"Compression", "Compression",
DropdownInput("audio_compression", "Audio compression", options=[ DropdownInput("audio_compression", "Audio compression", options=[
DropdownOption("adpcm", "ADPCM"), Option("adpcm", "ADPCM"),
DropdownOption("none", "None"), Option("none", "None"),
]), ]),
DropdownInput("fft_compression", "Waterfall compression", options=[ DropdownInput("fft_compression", "Waterfall compression", options=[
DropdownOption("adpcm", "ADPCM"), Option("adpcm", "ADPCM"),
DropdownOption("none", "None"), Option("none", "None"),
]), ]),
), ),
Section( Section(