Check-in [dc1a3bfef9]
Overview
| Comment: | Extra buttons sorted by icon name. -- Rocus | 
|---|---|
| Downloads: | Tarball | ZIP archive | SQL archive | 
| Timelines: | family | ancestors | descendants | both | trunk | 
| Files: | files | file ages | folders | 
| SHA1: | dc1a3bfef97cbb73b470aafeca75d8dc | 
| User & Date: | mario on 2016-12-24 20:11:21 | 
| Other Links: | manifest | tags | 
Context
| 2016-12-24 | ||
| 20:16 | Prevent crash on absent url:/title: field check-in: 89269a097c user: mario tags: trunk | |
| 20:11 | Extra buttons sorted by icon name. -- Rocus check-in: dc1a3bfef9 user: mario tags: trunk | |
| 2016-12-23 | ||
| 22:22 | Moved backslash conversion and .load() override back into file browser plugin. check-in: 60ee1e2e12 user: mario tags: trunk | |
Changes
Modified channels/specbuttons.py from [b738a29198] to [bb248c330b].
| 1 2 3 | # encoding: utf-8 # title: Spec buttons for apps # description: Adds configurable mini toolbar buttons | | | 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 | 
        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
 | | > > | 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),
 | 
| ︙ | ︙ |