mirror of
https://github.com/jketterl/openwebrx.git
synced 2026-04-20 22:05:13 +00:00
Merge pull request #235 from jancona/hpsdr_config
Set proper config options for HPSDR connector
This commit is contained in:
commit
4b969fa3b2
3 changed files with 36 additions and 2 deletions
|
|
@ -109,8 +109,8 @@ class TextInput(Input):
|
|||
|
||||
|
||||
class NumberInput(Input):
|
||||
def __init__(self, id, label, infotext=None, append="", converter: Converter = None):
|
||||
super().__init__(id, label, infotext, converter=converter)
|
||||
def __init__(self, id, label, infotext=None, append="", converter: Converter = None, validator: Validator = None):
|
||||
super().__init__(id, label, infotext, converter=converter, validator=validator)
|
||||
self.step = None
|
||||
self.append = append
|
||||
|
||||
|
|
|
|||
|
|
@ -12,3 +12,15 @@ class RequiredValidator(Validator):
|
|||
def validate(self, key, value):
|
||||
if value is None or value == "":
|
||||
raise ValidationError(key, "Field is required")
|
||||
|
||||
class RangeValidator(Validator):
|
||||
def __init__(self, minValue, maxValue):
|
||||
self.minValue = minValue
|
||||
self.maxValue = maxValue
|
||||
|
||||
def validate(self, key, value):
|
||||
if value is None or value == "":
|
||||
return # Ignore empty values
|
||||
n = float(value)
|
||||
if n < self.minValue or n > self.maxValue:
|
||||
raise ValidationError(key, 'Value must be between %s and %s'%(self.minValue, self.maxValue))
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue