Fix bug introduced when AttrWrap was replaced by AttrMap.

AttrWrap transparently passes method calls through to the widget
but you need to use the original_widget attribute with AttrMap to
access methods on the underlying widget.
This commit is contained in:
Ferdi Franceschini
2014-06-24 12:45:18 +10:00
parent bd97a75e9d
commit a363bc3c2c

View File

@ -22,7 +22,7 @@ def read_config_file(config_filename):
def reread_config_file(config_filename, cb_list): def reread_config_file(config_filename, cb_list):
config = read_config_file(config_filename) config = read_config_file(config_filename)
for cb in cb_list: for cb in cb_list:
lbl = cb.get_label() lbl = cb.original_widget.get_label()
if ":" in lbl: if ":" in lbl:
lbl = lbl.split(":")[0] lbl = lbl.split(":")[0]
state = False state = False
@ -30,7 +30,7 @@ def reread_config_file(config_filename, cb_list):
if config.get(lbl, 'enabled').lower() in ['1', 'yes', 'true']: if config.get(lbl, 'enabled').lower() in ['1', 'yes', 'true']:
state = True state = True
config.set(lbl, 'enabled', str(state)) config.set(lbl, 'enabled', str(state))
cb.set_state(state, False) cb.original_widget.set_state(state, False)
return config return config
def write_config_file(config, config_filename): def write_config_file(config, config_filename):
@ -58,11 +58,11 @@ def do_cascade(config, name, cb_list, label, new_state):
if label in config.options(name): if label in config.options(name):
cascade_list = config.get(name, label).lower().split(",") cascade_list = config.get(name, label).lower().split(",")
for cb in cb_list: for cb in cb_list:
lbl = cb.get_label().lower() lbl = cb.original_widget.get_label().lower()
if ":" in lbl: if ":" in lbl:
lbl = lbl.split(":")[0] lbl = lbl.split(":")[0]
if lbl in cascade_list: if lbl in cascade_list:
cb.set_state(new_state) cb.original_widget.set_state(new_state)
finally: finally:
depth_list.pop() depth_list.pop()