Add account settings change support

fsp_feeds
Tyler Goodlet 2021-09-07 09:22:24 -04:00
parent 09d34f7355
commit 7b86b6ae20
1 changed files with 4 additions and 2 deletions

View File

@ -92,7 +92,6 @@ class SettingsPane:
'''Called on any order pane edit field value change.
'''
print(f'settings change: {key}: {value}')
alloc = self.alloc
size_unit = alloc.size_unit
@ -112,12 +111,14 @@ class SettingsPane:
pass
elif key == 'account':
print(f'TODO: change account -> {value}')
account_name = value or 'paper'
assert alloc.account_name() == account_name
else:
raise ValueError(f'Unknown setting {key}')
# read out settings and update UI
log.info(f'settings change: {key}: {value}')
suffix = {'currency': ' $', 'units': ' u'}[size_unit]
limit = alloc.limit()
@ -142,6 +143,7 @@ class SettingsPane:
self.form.fields['size_unit'].setCurrentText(
alloc._size_units[alloc.size_unit]
)
self.form.fields['account'].setCurrentText(alloc.account_name())
self.form.fields['slots'].setText(str(alloc.slots))
self.form.fields['limit'].setText(str(limit))