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. '''Called on any order pane edit field value change.
''' '''
print(f'settings change: {key}: {value}')
alloc = self.alloc alloc = self.alloc
size_unit = alloc.size_unit size_unit = alloc.size_unit
@ -112,12 +111,14 @@ class SettingsPane:
pass pass
elif key == 'account': elif key == 'account':
print(f'TODO: change account -> {value}') account_name = value or 'paper'
assert alloc.account_name() == account_name
else: else:
raise ValueError(f'Unknown setting {key}') raise ValueError(f'Unknown setting {key}')
# 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()
@ -142,6 +143,7 @@ class SettingsPane:
self.form.fields['size_unit'].setCurrentText( self.form.fields['size_unit'].setCurrentText(
alloc._size_units[alloc.size_unit] 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['slots'].setText(str(alloc.slots))
self.form.fields['limit'].setText(str(limit)) self.form.fields['limit'].setText(str(limit))