Just log error on invalid order mode settings

fsp_feeds
Tyler Goodlet 2021-09-16 11:26:11 -04:00
parent 3e25be6321
commit da8bccf788
1 changed files with 22 additions and 15 deletions

View File

@ -208,26 +208,33 @@ class SettingsPane:
size_unit = alloc.size_unit size_unit = alloc.size_unit
# WRITE any settings to current pp's allocator # WRITE any settings to current pp's allocator
if key == 'limit': try:
if size_unit == 'currency': if key == 'limit':
alloc.currency_limit = float(value) if size_unit == 'currency':
else: # old = alloc.currency_limit
alloc.units_limit = float(value) alloc.currency_limit = float(value)
else:
# old = alloc.units_limit
alloc.units_limit = float(value)
elif key == 'slots': elif key == 'slots':
alloc.slots = int(value) # old = alloc.slots
alloc.slots = int(value)
elif key == 'size_unit': elif key == 'size_unit':
# TODO: if there's a limit size unit change re-compute # TODO: if there's a limit size unit change re-compute
# the current settings in the new units # the current settings in the new units
alloc.size_unit = value alloc.size_unit = value
elif key != 'account': elif key != 'account':
raise ValueError(f'Unknown setting {key}') raise ValueError(f'Unknown setting {key}')
log.info(f'settings change: {key}: {value}')
except ValueError:
log.error(f'Invalid value for `{key}`: {value}')
# READ out settings and update UI # READ out settings and update UI
log.info(f'settings change: {key}: {value}')
suffix = {'currency': ' $', 'units': ' u'}[size_unit] suffix = {'currency': ' $', 'units': ' u'}[size_unit]
limit = alloc.limit() limit = alloc.limit()