updated configutils parser to save values within configoptions, allowing them to be reused to redraw a config
This commit is contained in:
parent
8c4ed15629
commit
c5d5226384
2 changed files with 7 additions and 7 deletions
|
@ -78,9 +78,8 @@ def parse_config(options, values):
|
||||||
|
|
||||||
:param dict options: option key mapping to configuration options
|
:param dict options: option key mapping to configuration options
|
||||||
:param dict values: option key mapping to widget values
|
:param dict values: option key mapping to widget values
|
||||||
:return:
|
:return: nothing
|
||||||
"""
|
"""
|
||||||
config = {}
|
|
||||||
for key in options:
|
for key in options:
|
||||||
option = options[key]
|
option = options[key]
|
||||||
value = values[key]
|
value = values[key]
|
||||||
|
@ -88,8 +87,8 @@ def parse_config(options, values):
|
||||||
config_value = value.get()
|
config_value = value.get()
|
||||||
if config_type == ConfigType.BOOL:
|
if config_type == ConfigType.BOOL:
|
||||||
if config_value == "On":
|
if config_value == "On":
|
||||||
config_value = "1"
|
option.value = "1"
|
||||||
else:
|
else:
|
||||||
config_value = "0"
|
option.value = "0"
|
||||||
config[key] = config_value
|
else:
|
||||||
return config
|
option.value = config_value
|
||||||
|
|
|
@ -27,8 +27,9 @@ class SessionOptionsDialog(Dialog):
|
||||||
self.cancel_button.grid(row=1, column=1, pady=PAD_Y, padx=PAD_X, sticky="ew")
|
self.cancel_button.grid(row=1, column=1, pady=PAD_Y, padx=PAD_X, sticky="ew")
|
||||||
|
|
||||||
def save(self):
|
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
|
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)
|
response = self.app.core.client.set_session_options(session_id, config)
|
||||||
logging.info("saved session config: %s", response)
|
logging.info("saved session config: %s", response)
|
||||||
self.destroy()
|
self.destroy()
|
||||||
|
|
Loading…
Add table
Reference in a new issue