Internet radio browser GUI for music/video streams from various directory services.

⌈⌋ ⎇ branch:  streamtuner2


Check-in [ecbafb9a1c]

Overview
Comment:Support for markup in checkbox config options.
Downloads: Tarball | ZIP archive | SQL archive
Timelines: family | ancestors | descendants | both | trunk
Files: files | file ages | folders
SHA1: ecbafb9a1c53037aeaa55e288013e1aa181ad3bf
User & Date: mario on 2017-01-25 19:14:56
Other Links: manifest | tags
Context
2017-01-25
19:15
Use bold tags for config descriptions instead of Unicode workaround. Group flags by category: basic, extra, verbose to filter out uneeded ones. check-in: 8bcd2bc3d5 user: mario tags: trunk
19:14
Support for markup in checkbox config options. check-in: ecbafb9a1c user: mario tags: trunk
19:14
Added pip -U for mutagen; typo fixes. check-in: ccc551cb58 user: Oliver tags: trunk
Changes

Modified channels/configwin.py from [80c7c7f2e2] to [7398b09535].

139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154


155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
        add_( "config_plugins_"+name, cb, color=meta.get("color"), image=meta.get("png"), align=0)

        # Default values are already in conf[] dict
        # (now done in conf.add_plugin_defaults)
        for opt in meta["config"]:
            color = opt.get("color", None)
            type = opt.get("type", "str")
            description = opt.get("description", "./.")
            
            # hidden
            if opt.get("hidden"):
                continue 

            # display checkbox
            elif opt["type"] in ("bool", "boolean"):
                cb = gtk.CheckButton(opt["description"])


                description = None

            # drop down list
            elif opt["type"] in ("select", "choose", "options"):
                cb = ComboBoxText(ComboBoxText.parse_options(opt.get("select"))) # custom uikit widget

            # numeric
            elif opt["type"] in ("int", "integer", "numeric"):
                adj = gtk.Adjustment(0, 0, 5000, 1, 10, 0)
                if ver == 2:
                    cb = gtk.SpinButton(adj, 1.0, 0)
                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_( 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()







|






|
|
>
>
|


|



|
|












|






|







139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
        add_( "config_plugins_"+name, cb, color=meta.get("color"), image=meta.get("png"), align=0)

        # Default values are already in conf[] dict
        # (now done in conf.add_plugin_defaults)
        for opt in meta["config"]:
            color = opt.get("color", None)
            type = opt.get("type", "str")
            desc = opt.get("description", "./.")
            
            # hidden
            if opt.get("hidden"):
                continue 

            # display checkbox
            elif type in ("bool", "boolean"):
                cb = gtk.CheckButton(desc)
                if re.search("<(\w+)[^>]*>.+</\\1>", desc):
                    cb.get_child().set_use_markup(True)
                desc = None

            # drop down list
            elif type in ("select", "choose", "options"):
                cb = ComboBoxText(ComboBoxText.parse_options(opt.get("select"))) # custom uikit widget

            # numeric
            elif type in ("int", "integer", "numeric"):
                adj = gtk.Adjustment(0, 0, int(opt.get("max", 5000)), 1, 10, 0)
                if ver == 2:
                    cb = gtk.SpinButton(adj, 1.0, 0)
                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>" % desc, markup=True, size=455))
                continue

            # text field
            else:
                cb = gtk.Entry()
           
            add_( prefix_+opt["name"], cb, desc, color )

        # Spacer between plugins
        add_( None, gtk.HSeparator() )

    # Reformat `doc` linebreaks for gtk.tooltip
    def _tooltip(self, meta):
        doc = meta.get("doc", "").strip()