Diff
Differences From Artifact [0227a222a4]:
- File channels/configwin.py — part of check-in [095de3353f] at 2016-10-27 16:42:04 on branch trunk — Introduce `dict` configuration type, prepare TreeView in uikit (similar to record/play config table). (user: mario, size: 8042) [annotate] [blame] [check-ins using]
To Artifact [834ef930af]:
- File
channels/configwin.py
— part of check-in
[d90db23c73]
at
2016-10-28 18:11:30
on branch trunk
— Move liststore_edit() and app_bin_check() from configwin. to uikit.
Allow ListStore for config_play/_record/_specbuttons without `editable` row [2], which is now a property of the CellRenderers (instead of a cell-attribute).
Specialized uikit.config_treeview() builds a custom two-column TreeView now. (user: mario, size: 7318) [annotate] [blame] [check-ins using]
1 2 3 4 5 6 7 | # api: streamtuner2 # title: Config dialog # description: Allows to configure players, options, and plugins # version: 2.5 # type: feature # category: ui # config: - | < | 1 2 3 4 5 6 7 8 9 10 11 12 13 14 | # api: streamtuner2 # title: Config dialog # description: Allows to configure players, options, and plugins # version: 2.5 # type: feature # category: ui # config: - # priority: core # # Configuration dialog for audio applications, # general settings, and plugin activaiton and # their options. |
| ︙ | ︙ | |||
66 67 68 69 70 71 72 |
# number
elif isinstance(w, gtk.SpinButton):
w.set_value(int(val))
# list
elif isinstance(w, gtk.ListStore) and isinstance(val, dict):
w.clear()
for k,v in val.items():
| | | | 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 |
# number
elif isinstance(w, gtk.SpinButton):
w.set_value(int(val))
# list
elif isinstance(w, gtk.ListStore) and isinstance(val, dict):
w.clear()
for k,v in val.items():
w.append([k, v, uikit.app_bin_check(v)])
w.append(["", "", gtk.STOCK_NEW])
#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:
|
| ︙ | ︙ | |||
95 96 97 98 99 100 101 |
elif isinstance(w, gtk.ListStore):
config[key] = {}
for row in w:
if row[0] and row[1]:
config[key][row[0]] = row[1]
log.CONF("config save", prefix+key, val)
| < < < < < < < < < < < < < < < < < < < < < | 94 95 96 97 98 99 100 101 102 103 104 105 106 107 |
elif isinstance(w, gtk.ListStore):
config[key] = {}
for row in w:
if row[0] and row[1]:
config[key][row[0]] = row[1]
log.CONF("config save", prefix+key, val)
# iterate over channel and feature plugins
def add_plugins(self):
ls = all_plugin_meta()
for name,meta in sorted(ls.items(), key=lambda e: e[1]["type"]+e[1]["title"].lower(), reverse=False):
if not name in conf.plugins:
conf.plugins[name] = False
|
| ︙ | ︙ | |||
175 176 177 178 179 180 181 |
else:
cb = gtk.SpinButton()
cb.set_adjustment(adj)
cb.set_digits(0)
# ListView
elif opt["type"] in ("list", "table", "array", "dict"):
| | > | 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 |
else:
cb = gtk.SpinButton()
cb.set_adjustment(adj)
cb.set_digits(0)
# ListView
elif opt["type"] in ("list", "table", "array", "dict"):
cb, ls = uikit.config_treeview(opt, opt.get("columns", "Key,Value").split(","))
add_("cfgui_tv", cb, "", None)
self.widgets["config_" + opt["name"]] = ls
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 )
|
| ︙ | ︙ |