waterfall config fine-adjustments
* hide the waterfall colors input when pre-defined color scheme is selected * skip unparseable lines on custom color input * fallback to black and white if custom color config is unusable * always use the waterfall classes when sending changes to the client
This commit is contained in:
@ -76,10 +76,14 @@ class WaterfallColorsConverter(Converter):
|
||||
|
||||
def convert_from_form(self, value):
|
||||
def parseString(s):
|
||||
if s.startswith("#"):
|
||||
return int(s[1:], 16)
|
||||
# int() with base 0 can accept "0x" prefixed hex strings, or int numbers
|
||||
return int(s, 0)
|
||||
try:
|
||||
if s.startswith("#"):
|
||||
return int(s[1:], 16)
|
||||
# int() with base 0 can accept "0x" prefixed hex strings, or int numbers
|
||||
return int(s, 0)
|
||||
except ValueError:
|
||||
return None
|
||||
|
||||
# \r\n or \n? this should work with both.
|
||||
return [parseString(v.strip("\r ")) for v in value.split("\n")]
|
||||
values = [parseString(v.strip("\r ")) for v in value.split("\n")]
|
||||
return [v for v in values if v is not None]
|
||||
|
Reference in New Issue
Block a user