︙ | | | ︙ | |
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
|
# Hide window
def hide(self, *args):
self.win_config.hide()
return True
# Load values from conf. store into gtk widgets
def load_config(self, config, prefix="config_"):
for key,val in config.items():
w = self.main.get_widget(prefix + key)
if w:
# number
if isinstance(w, gtk.SpinButton):
w.set_value(int(val))
# input field
elif isinstance(w, gtk.Entry):
w.set_text(str(val))
|
|
|
|
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
|
# Hide window
def hide(self, *args):
self.win_config.hide()
return True
# Load values from conf. store into gtk widgets
def load_config(self, config, prefix="config_", widgets={}):
for key,val in config.items():
w = self.main.get_widget(prefix + key) or widgets.get(prefix + key)
if w:
# number
if isinstance(w, gtk.SpinButton):
w.set_value(int(val))
# input field
elif isinstance(w, gtk.Entry):
w.set_text(str(val))
|
︙ | | | ︙ | |
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
|
log.DATA(row)
w.append([str(e) for e in row])
if len(val):
w.append(["" for e in val[0]])
#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):
for key,val in config.items():
w = self.main.get_widget(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()
|
|
|
|
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
|
log.DATA(row)
w.append([str(e) for e in row])
if len(val):
w.append(["" for e in val[0]])
#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()
|
︙ | | | ︙ | |
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
|
# Description text
plugin_text = "<span size='larger' weight='heavy'>{title}</span> "\
+ "<span style='italic' foreground='slate blue'>({type}/{category})</span> "\
+ "<span weight='bold' foreground='#777777'>{version}</span>\n"\
+ "<span size='smaller' stretch='ultraexpanded'>{description}</span>"
# Add [x] plugin setting, and its configuration definitions, set defaults from conf.*
def add_plg(self, name, meta, add_):
# Plugin enable button
cb = gtk.CheckButton(name)
cb.set_sensitive(not meta.get("priority") in ("core", "required", "builtin"))
cb.get_children()[0].set_markup(self.plugin_text.format(**meta))
cb.set_tooltip_text(self._tooltip(meta))
add_( "config_plugins_"+name, cb, color=meta.get("color"), image=meta.get("png"), align=0)
|
|
|
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
|
# Description text
plugin_text = "<span size='larger' weight='heavy'>{title}</span> "\
+ "<span style='italic' foreground='slate blue'>({type}/{category})</span> "\
+ "<span weight='bold' foreground='#777777'>{version}</span>\n"\
+ "<span size='smaller' stretch='ultraexpanded'>{description}</span>"
# Add [x] plugin setting, and its configuration definitions, set defaults from conf.*
def add_plg(self, name, meta, add_, prefix_="config_"):
# Plugin enable button
cb = gtk.CheckButton(name)
cb.set_sensitive(not meta.get("priority") in ("core", "required", "builtin"))
cb.get_children()[0].set_markup(self.plugin_text.format(**meta))
cb.set_tooltip_text(self._tooltip(meta))
add_( "config_plugins_"+name, cb, color=meta.get("color"), image=meta.get("png"), align=0)
|
︙ | | | ︙ | |
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
|
add_({}, uikit.label("<small>%s</small>" % description, markup=True, size=455))
continue
# text field
else:
cb = gtk.Entry()
add_( "config_"+opt["name"], cb, description, color )
# Spacer between plugins
add_( None, gtk.HSeparator() )
# Reformat `doc` linebreaks for gtk.tooltip
def _tooltip(self, meta):
doc = meta.get("doc", "").strip()
|
|
|
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
|
add_({}, uikit.label("<small>%s</small>" % description, markup=True, size=455))
continue
# text field
else:
cb = gtk.Entry()
add_( prefix_+opt["name"], cb, description, color )
# Spacer between plugins
add_( None, gtk.HSeparator() )
# Reformat `doc` linebreaks for gtk.tooltip
def _tooltip(self, meta):
doc = meta.get("doc", "").strip()
|
︙ | | | ︙ | |