updated configutils parser to save values within configoptions, allowing them to be reused to redraw a config

This commit is contained in:
Blake Harnden 2019-11-04 16:20:35 -08:00
parent 8c4ed15629
commit c5d5226384
2 changed files with 7 additions and 7 deletions

View file

@ -78,9 +78,8 @@ def parse_config(options, values):
:param dict options: option key mapping to configuration options
:param dict values: option key mapping to widget values
:return:
:return: nothing
"""
config = {}
for key in options:
option = options[key]
value = values[key]
@ -88,8 +87,8 @@ def parse_config(options, values):
config_value = value.get()
if config_type == ConfigType.BOOL:
if config_value == "On":
config_value = "1"
option.value = "1"
else:
config_value = "0"
config[key] = config_value
return config
option.value = "0"
else:
option.value = config_value

View file

@ -27,8 +27,9 @@ class SessionOptionsDialog(Dialog):
self.cancel_button.grid(row=1, column=1, pady=PAD_Y, padx=PAD_X, sticky="ew")
def save(self):
config = configutils.parse_config(self.options, self.values)
configutils.parse_config(self.options, self.values)
session_id = self.app.core.session_id
config = {x: self.options[x].value for x in self.options}
response = self.app.core.client.set_session_options(session_id, config)
logging.info("saved session config: %s", response)
self.destroy()