81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
|
#log.CONF("config load", prefix+key, val, type(w))
# Store gtk widget valus back into conf. dict
def save_config(self, config, prefix="config_", save=0, widgets={}):
for key,val in config.items():
w = self.main.get_widget(prefix + key) or widgets.get(prefix + key)
if w:
# text
if isinstance(w, gtk.Entry):
config[key] = w.get_text()
# pre-defined text
elif isinstance(w, ComboBoxText):
config[key] = w.get_active_text()
# boolean
elif isinstance(w, gtk.CheckButton):
config[key] = w.get_active()
# int
elif isinstance(w, gtk.SpinButton):
config[key] = int(w.get_value(val))
# dict
elif isinstance(w, gtk.ListStore):
if key in config and isinstance(config[key], list):
config[key] = []
for row in w:
config[key].append([str(e) for e in row])
else:
|
>
>
>
|
<
<
<
|
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
|
#log.CONF("config load", prefix+key, val, type(w))
# Store gtk widget valus back into conf. dict
def save_config(self, config, prefix="config_", save=0, widgets={}):
for key,val in config.items():
w = self.main.get_widget(prefix + key) or widgets.get(prefix + key)
if w:
# int
if isinstance(w, gtk.SpinButton):
config[key] = int(w.get_value())
# text
elif isinstance(w, gtk.Entry):
config[key] = w.get_text()
# pre-defined text
elif isinstance(w, ComboBoxText):
config[key] = w.get_active_text()
# boolean
elif isinstance(w, gtk.CheckButton):
config[key] = w.get_active()
# dict
elif isinstance(w, gtk.ListStore):
if key in config and isinstance(config[key], list):
config[key] = []
for row in w:
config[key].append([str(e) for e in row])
else:
|