1
2
3
4
5
6
7
8
9
10
11 | # encoding: utf-8
# title: Spec buttons for apps
# description: Adds configurable mini toolbar buttons
# version: 0.8.1
# 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, columns: "Icon,Command", description: "Icons can be `<a href='http://www.pygtk.org/pygtk2reference/gtk-stock-items.html'>gtk-xyz</a>` internal names. Else use `/usr/share/icon/*.png` file names. Icon file basenames will be expanded into full paths." }
# documentation: |
|
| 1
2
3
4
5
6
7
8
9
10
11 | # encoding: utf-8
# title: Spec buttons for apps
# description: Adds configurable mini toolbar buttons
# version: 0.8.2
# 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, columns: "Icon,Command", description: "Icons can be `<a href='http://www.pygtk.org/pygtk2reference/gtk-stock-items.html'>gtk-xyz</a>` internal names. Else use `/usr/share/icon/*.png` file names. Icon file basenames will be expanded into full paths." }
# documentation: |
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73 | y = max(min(int(conf.specbutton_rows), 4), 1) # 1 <= y <= 4
self.specbuttons.resize(y, int(math.ceil(len(conf.specbuttons) / y)))
# clean up
for widget in self.specbuttons.get_children():
widget.destroy()
# add icon buttons
for xy, (btn, cmd) in enumerate(conf.specbuttons.items()):
#log.IN(btn, cmd)
w_btn = gtk.Button()
w_btn.set_image(self.icon(btn))
w_btn.connect("clicked", lambda x0, cmd=cmd, *x: self.action(cmd))
self.specbuttons.attach(
child = w_btn,
left_attach = int(xy / y), |
|
>
>
| 59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75 | y = max(min(int(conf.specbutton_rows), 4), 1) # 1 <= y <= 4
self.specbuttons.resize(y, int(math.ceil(len(conf.specbuttons) / y)))
# clean up
for widget in self.specbuttons.get_children():
widget.destroy()
# add icon buttons
#for xy, (btn, cmd) in enumerate(conf.specbuttons.items()):
for xy, (btn) in enumerate( sorted ( conf.specbuttons )):
cmd = conf.specbuttons [btn]
#log.IN(btn, cmd)
w_btn = gtk.Button()
w_btn.set_image(self.icon(btn))
w_btn.connect("clicked", lambda x0, cmd=cmd, *x: self.action(cmd))
self.specbuttons.attach(
child = w_btn,
left_attach = int(xy / y), |