| 12345678910111213141516171819202122232425262728293031323334353637 |
- from helper import console
- from helper.settings import Settings
- def settings():
- while True:
- setting = console.option_picker('Choose which setting to change',
- Settings.__list__,
- quit=True,
- objects=[
- '__id__',
- 'x.name',
- 'x.str_value'
- ],
- table=[
- ('ID', 2),
- ('Setting', 20),
- ('Value', 100)
- ])
- if setting is None:
- console.output('Saving settings...')
- Settings.write()
- console.output('Settings saved')
- break
- else:
- entry = Settings.__list__[setting]
- value = console.ask_input('Enter new value', entry.type, quit=True)
- if value is None:
- console.output('Value not changed', console.DBG_INFO)
- continue
- else:
- console.output('Changing value of {x.name} from {x.value} to {new}'.format(x=entry, new=value), console.DBG_INFO)
- entry.set(value)
- return True
|