add the ability to put append a unit to inputs
This commit is contained in:
parent
8de70cd523
commit
b60a8a1af0
@ -95,6 +95,7 @@ class GeneralSettingsController(AdminController):
|
|||||||
"receiver_asl",
|
"receiver_asl",
|
||||||
"Receiver elevation",
|
"Receiver elevation",
|
||||||
infotext="Elevation in meters above mean see level",
|
infotext="Elevation in meters above mean see level",
|
||||||
|
append="m MSL",
|
||||||
),
|
),
|
||||||
TextInput("receiver_admin", "Receiver admin"),
|
TextInput("receiver_admin", "Receiver admin"),
|
||||||
LocationInput("receiver_gps", "Receiver coordinates"),
|
LocationInput("receiver_gps", "Receiver coordinates"),
|
||||||
@ -114,19 +115,20 @@ class GeneralSettingsController(AdminController):
|
|||||||
"Waterfall settings",
|
"Waterfall settings",
|
||||||
NumberInput(
|
NumberInput(
|
||||||
"fft_fps",
|
"fft_fps",
|
||||||
"FFT frames per second",
|
"FFT speed",
|
||||||
infotext="This setting specifies how many lines are being added to the waterfall per second. "
|
infotext="This setting specifies how many lines are being added to the waterfall per second. "
|
||||||
+ "Higher values will give you a faster waterfall, but will also use more CPU.",
|
+ "Higher values will give you a faster waterfall, but will also use more CPU.",
|
||||||
|
append="frames per second",
|
||||||
),
|
),
|
||||||
NumberInput("fft_size", "FFT size"),
|
NumberInput("fft_size", "FFT size", append="bins"),
|
||||||
FloatInput(
|
FloatInput(
|
||||||
"fft_voverlap_factor",
|
"fft_voverlap_factor",
|
||||||
"FFT vertical overlap factor",
|
"FFT vertical overlap factor",
|
||||||
infotext="If fft_voverlap_factor is above 0, multiple FFTs will be used for creating a line on the "
|
infotext="If fft_voverlap_factor is above 0, multiple FFTs will be used for creating a line on the "
|
||||||
+ "diagram.",
|
+ "diagram.",
|
||||||
),
|
),
|
||||||
NumberInput("waterfall_min_level", "Lowest waterfall level"),
|
NumberInput("waterfall_min_level", "Lowest waterfall level", append="dBFS"),
|
||||||
NumberInput("waterfall_max_level", "Highest waterfall level"),
|
NumberInput("waterfall_max_level", "Highest waterfall level", append="dBFS"),
|
||||||
),
|
),
|
||||||
Section(
|
Section(
|
||||||
"Compression",
|
"Compression",
|
||||||
@ -150,7 +152,7 @@ class GeneralSettingsController(AdminController):
|
|||||||
Section(
|
Section(
|
||||||
"Digimodes",
|
"Digimodes",
|
||||||
CheckboxInput("digimodes_enable", "", checkboxText="Enable Digimodes"),
|
CheckboxInput("digimodes_enable", "", checkboxText="Enable Digimodes"),
|
||||||
NumberInput("digimodes_fft_size", "Digimodes FFT size"),
|
NumberInput("digimodes_fft_size", "Digimodes FFT size", append="bins"),
|
||||||
),
|
),
|
||||||
Section(
|
Section(
|
||||||
"Digital voice",
|
"Digital voice",
|
||||||
@ -199,7 +201,8 @@ class GeneralSettingsController(AdminController):
|
|||||||
NumberInput(
|
NumberInput(
|
||||||
"map_position_retention_time",
|
"map_position_retention_time",
|
||||||
"Map retention time",
|
"Map retention time",
|
||||||
infotext="Unit is seconds<br/>Specifies how log markers / grids will remain visible on the map",
|
infotext="Specifies how log markers / grids will remain visible on the map",
|
||||||
|
append="s",
|
||||||
),
|
),
|
||||||
),
|
),
|
||||||
Section(
|
Section(
|
||||||
|
@ -53,19 +53,35 @@ class TextInput(Input):
|
|||||||
|
|
||||||
|
|
||||||
class NumberInput(Input):
|
class NumberInput(Input):
|
||||||
def __init__(self, id, label, infotext=None):
|
def __init__(self, id, label, infotext=None, append=""):
|
||||||
super().__init__(id, label, infotext)
|
super().__init__(id, label, infotext)
|
||||||
self.step = None
|
self.step = None
|
||||||
|
self.append = append
|
||||||
|
|
||||||
def render_input(self, value):
|
def render_input(self, value):
|
||||||
|
if self.append:
|
||||||
|
append = """
|
||||||
|
<div class="input-group-append">
|
||||||
|
<span class="input-group-text">{append}</span>
|
||||||
|
</div>
|
||||||
|
""".format(
|
||||||
|
append=self.append
|
||||||
|
)
|
||||||
|
else:
|
||||||
|
append = ""
|
||||||
|
|
||||||
return """
|
return """
|
||||||
<input type="number" class="{classes}" id="{id}" name="{id}" placeholder="{label}" value="{value}" {step}>
|
<div class="input-group input-group-sm">
|
||||||
|
<input type="number" class="{classes}" id="{id}" name="{id}" placeholder="{label}" value="{value}" {step}>
|
||||||
|
{append}
|
||||||
|
</div>
|
||||||
""".format(
|
""".format(
|
||||||
id=self.id,
|
id=self.id,
|
||||||
label=self.label,
|
label=self.label,
|
||||||
classes=self.input_classes(),
|
classes=self.input_classes(),
|
||||||
value=value,
|
value=value,
|
||||||
step='step="{0}"'.format(self.step) if self.step else "",
|
step='step="{0}"'.format(self.step) if self.step else "",
|
||||||
|
append=append,
|
||||||
)
|
)
|
||||||
|
|
||||||
def convert_from_form(self, v):
|
def convert_from_form(self, v):
|
||||||
|
Loading…
Reference in New Issue
Block a user