Avoid value error on puterizing unit name

win_fixes
Tyler Goodlet 2021-10-12 10:33:51 -04:00
parent c737de7c74
commit 75fddb249c
1 changed files with 17 additions and 16 deletions

View File

@ -152,7 +152,7 @@ class SettingsPane:
'''Called on any order pane drop down selection change. '''Called on any order pane drop down selection change.
''' '''
log.info(f'selection input: {text}') log.info(f'selection input {key}:{text}')
self.on_ui_settings_change(key, text) self.on_ui_settings_change(key, text)
def on_ui_settings_change( def on_ui_settings_change(
@ -209,6 +209,12 @@ class SettingsPane:
# WRITE any settings to current pp's allocator # WRITE any settings to current pp's allocator
try: try:
if key == 'size_unit':
# implicit re-write of value if input
# is the "text name" of the units.
# yah yah, i know this is badd..
alloc.size_unit = value
else:
value = puterize(value) value = puterize(value)
if key == 'limit': if key == 'limit':
if size_unit == 'currency': if size_unit == 'currency':
@ -219,11 +225,6 @@ class SettingsPane:
elif key == 'slots': elif key == 'slots':
alloc.slots = int(value) 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
else: else:
raise ValueError(f'Unknown setting {key}') raise ValueError(f'Unknown setting {key}')