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
# WRITE any settings to current pp's allocator
if key == 'limit':
if size_unit == 'currency':
alloc.currency_limit = float(value)
else:
alloc.units_limit = float(value)
try:
if key == 'limit':
if size_unit == 'currency':
# old = alloc.currency_limit
alloc.currency_limit = float(value)
else:
# old = alloc.units_limit
alloc.units_limit = float(value)
elif key == 'slots':
alloc.slots = int(value)
elif key == 'slots':
# old = alloc.slots
alloc.slots = int(value)
elif key == 'size_unit':
# TODO: if there's a limit size unit change re-compute
# the current settings in the new units
alloc.size_unit = value
elif key == 'size_unit':
# TODO: if there's a limit size unit change re-compute
# the current settings in the new units
alloc.size_unit = value
elif key != 'account':
raise ValueError(f'Unknown setting {key}')
elif key != 'account':
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
log.info(f'settings change: {key}: {value}')
suffix = {'currency': ' $', 'units': ' u'}[size_unit]
limit = alloc.limit()