Index: channels/configwin.py ================================================================== --- channels/configwin.py +++ channels/configwin.py @@ -3,10 +3,11 @@ # description: Allows to configure players, options, and plugins # version: 2.5 # type: feature # category: ui # config: - +# { name: arraysample, value: "1,2", type: array, rows: "xxx,yyy", description: table } # priority: core # # Configuration dialog for audio applications, # general settings, and plugin activaiton and # their options. @@ -64,11 +65,11 @@ w.set_default(val) # number elif isinstance(w, gtk.SpinButton): w.set_value(int(val)) # list - elif isinstance(w, gtk.ListStore): + elif isinstance(w, gtk.ListStore) and isinstance(val, dict): w.clear() for k,v in val.items(): w.append([k, v, True, self.app_bin_check(v)]) w.append(["", "", True, gtk.STOCK_NEW]) #log.CONF("config load", prefix+key, val, type(w)) @@ -174,10 +175,17 @@ 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) + add_("cfgui_tv", cb, "", None) + self.widgets["config_" + opt["name"]] = ls + continue + # text field else: cb = gtk.Entry() add_( "config_"+opt["name"], cb, description, color ) Index: channels/specbuttons.py ================================================================== --- channels/specbuttons.py +++ channels/specbuttons.py @@ -5,10 +5,11 @@ # depends: streamtuner2 >= 2.2.0 # type: feature # category: ui # config: # { name: specbutton_rows, value: 2, max: 4, type: int, description: "Number of rows to arrange buttons in." } +# { name: specbuttons, type: dict, rows: "icon,command", description: "Associate icons to external commands." } # doc: # http://fossil.include-once.org/streamtuner2/info/43b36ed35b1488d5 # # Adds the mini/extra buttons in the toolbar, which allow to control your # audio player or run other system commands. The configuration list is in Index: gtk3.xml.gz ================================================================== --- gtk3.xml.gz +++ gtk3.xml.gz cannot compute difference between binary files Index: uikit.py ================================================================== --- uikit.py +++ uikit.py @@ -137,10 +137,11 @@ # next datapos += 1 #log.INFO(cell, len(cell)) # add column to treeview + #log.E(col) widget.append_column(col) # add data? if (entries is not None): #- expand datamap @@ -149,12 +150,12 @@ for desc in datamap: for var in xrange(2, len(desc)): vartypes.append(desc[var][1]) # content types rowmap.append(desc[var][0]) # dict{} column keys in entries[] list # create gtk array storage - ls = gtk.ListStore(*vartypes) # could be a TreeStore, too #log.UI(vartypes, len(vartypes)) + ls = gtk.ListStore(*vartypes) # could be a TreeStore, too #log.DATA(rowmap, len(rowmap)) # prepare for missing values, and special variable types defaults = { str: "", @@ -504,10 +505,35 @@ a.set_padding(0, 0, align, 0) a.add(w) w = a w.show_all() return w + + + # Config win table + @staticmethod + def config_treeview(opt): + w = gtk.TreeView() + w.set_property("width_request", 450) + w.set_property("height_request", 125) + # options + _k,_v = str(opt.get("rows", "x,y")).split(",") + # fill columns + liststore, rowmap, pix_entry = uikit.columns( + w, + [ # datamap + [_k,125, [_k,str,"text",{"editable":2}] ], + [_v,275, [_v,str,"text",{"editable":True}] ], + [None,0, ['b',bool,None,{}] ], + [None,0, ['i',str,None,{}] ] + ], + [{}] + ) + for i,tvc in enumerate(w.get_children()): + for tvcr in tvc.get_children(): + tvcr.connect("edited", lambda *x: log.EDIT(x)) + return w, liststore # Attach textual menu entry and callback @staticmethod def add_menu(menuwidget, label, action, insert=None):