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

⌈⌋ ⎇ branch:  streamtuner2


Check-in [bd411967bc]

Overview
Comment:Split plugin configuration into channels and [features] tabs.
Downloads: Tarball | ZIP archive | SQL archive
Timelines: family | ancestors | descendants | both | trunk
Files: files | file ages | folders
SHA1: bd411967bc9a802990426972bbb97f5039e861b5
User & Date: mario on 2015-04-24 05:00:23
Other Links: manifest | tags
Context
2015-04-24
05:01
Add .desktop and .url to export format file extensions probing and SaveAs dialog. check-in: a35c889740 user: mario tags: trunk
05:00
Split plugin configuration into channels and [features] tabs. check-in: bd411967bc user: mario tags: trunk
04:59
Disable update_streams_partially_done() for Gtk3, as that's the main cause of memory corruption (despite being run in idle loop). check-in: 1edde401ce user: mario tags: trunk
Changes

Modified channels/configwin.py from [fa4ff7a844] to [905b0713ca].

121
122
123
124
125
126
127

128
129
130
131
132
133
134
135
136
137
138
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
        #    elif name in self.features:
        #        ls[name] = self.features[name].meta
        #    else:
        #        ls[name] = plugin_meta(module=name)
        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

            self.add_plg(name, meta)


    # add configuration setting definitions from plugins
    plugin_text = "<span size='larger' weight='heavy'>%s</span> "\
                + "<span style='italic' foreground='slate blue'>(%s/%s)</span> "\
                + "<span weight='bold' foreground='#777777'>%s</span>\n"\
                + "<span size='smaller' stretch='ultraexpanded'>%s</span>"
    def add_plg(self, name, meta):
        # add plugin load entry
        cb = gtk.CheckButton(name)
        cb.set_sensitive(not meta.get("priority") in ("core", "required", "builtin"))
        cb.get_children()[0].set_markup(self.plugin_text % (meta.get("title", name), meta.get("type", "plugin"), meta.get("category", "addon"), meta.get("version", "./."), meta.get("description", "no description")))
        cb.set_tooltip_text(re.sub("(?<=\S) *\n(?! *\n)", " ",meta.get("doc", "")).strip())
        self.add_( "config_plugins_"+name, cb, color=meta.get("color"), image=meta.get("png"))

        # default values are already in conf[] dict (now done in conf.add_plugin_defaults)
        for opt in meta["config"]:
            color = opt.get("color", None)
            # display checkbox
            if opt["type"] == "boolean":
                cb = gtk.CheckButton(opt["description"])
                self.add_( "config_"+opt["name"], cb, color=color )
            # drop down list
            elif opt["type"] == "select":
                cb = ComboBoxText(ComboBoxText.parse_options(opt["select"])) # custom uikit widget
                self.add_( "config_"+opt["name"], cb, opt["description"], color )
            # text entry
            else:
                self.add_( "config_"+opt["name"], gtk.Entry(), opt["description"], color )

        # spacer 
        self.add_( "filler_pl_"+name, gtk.HSeparator() )


    # Put config widgets into config dialog notebook, wrap with label, or background, retain widget id/name
    def add_(self, id=None, w=None, label=None, color=None, image=None):
        if id:
            self.widgets[id] = w
        if label:
            if type(w) is gtk.Entry:
                w.set_width_chars(11)
            w = uikit.hbox(w, uikit.label(label))
        if image:
            pix = gtk.image_new_from_pixbuf(uikit.pixbuf(image))
            if pix:
                w = uikit.hbox(w, pix, exr=False)
        if color:
            w = uikit.bg(w, color)




        self.plugin_options.pack_start(w)
    




    # save config
    def save(self, widget):
        self.save_config(conf.__dict__, "config_")
        self.save_config(conf.plugins, "config_plugins_")
        [callback() for callback in self.hooks["config_save"]]
        conf.save(nice=1)
        self.hide()








>
|
|






|





|







|



|


|


|


|
|












>
>
>
>
|
|
>
>
>
>








121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
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
193
194
195
        #    elif name in self.features:
        #        ls[name] = self.features[name].meta
        #    else:
        #        ls[name] = plugin_meta(module=name)
        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
            add_ = self.add_channels if meta.get("type") == "channel" else self.add_features
            self.add_plg(name, meta, add_)
        pass

    # add configuration setting definitions from plugins
    plugin_text = "<span size='larger' weight='heavy'>%s</span> "\
                + "<span style='italic' foreground='slate blue'>(%s/%s)</span> "\
                + "<span weight='bold' foreground='#777777'>%s</span>\n"\
                + "<span size='smaller' stretch='ultraexpanded'>%s</span>"
    def add_plg(self, name, meta, add_):
        # add plugin load entry
        cb = gtk.CheckButton(name)
        cb.set_sensitive(not meta.get("priority") in ("core", "required", "builtin"))
        cb.get_children()[0].set_markup(self.plugin_text % (meta.get("title", name), meta.get("type", "plugin"), meta.get("category", "addon"), meta.get("version", "./."), meta.get("description", "no description")))
        cb.set_tooltip_text(re.sub("(?<=\S) *\n(?! *\n)", " ",meta.get("doc", "")).strip())
        add_( "config_plugins_"+name, cb, color=meta.get("color"), image=meta.get("png"))

        # default values are already in conf[] dict (now done in conf.add_plugin_defaults)
        for opt in meta["config"]:
            color = opt.get("color", None)
            # display checkbox
            if opt["type"] == "boolean":
                cb = gtk.CheckButton(opt["description"])
                add_( "config_"+opt["name"], cb, color=color )
            # drop down list
            elif opt["type"] == "select":
                cb = ComboBoxText(ComboBoxText.parse_options(opt["select"])) # custom uikit widget
                add_( "config_"+opt["name"], cb, opt["description"], color )
            # text entry
            else:
                add_( "config_"+opt["name"], gtk.Entry(), opt["description"], color )

        # spacer 
        add_( "filler_pl_"+name, gtk.HSeparator() )


    # Wrap entries/checkboxes with extra label, background, images, etc.
    def wrap_entry(self, id, w, label, color, image):
        if id:
            self.widgets[id] = w
        if label:
            if type(w) is gtk.Entry:
                w.set_width_chars(11)
            w = uikit.hbox(w, uikit.label(label))
        if image:
            pix = gtk.image_new_from_pixbuf(uikit.pixbuf(image))
            if pix:
                w = uikit.hbox(w, pix, exr=False)
        if color:
            w = uikit.bg(w, color)
        return w

    # Put config widgets into channels/features configwin notebooks
    def add_channels(self, id=None, w=None, label=None, color=None, image=None):
        self.plugin_options.pack_start(self.wrap_entry(id, w, label, color, image))

    # Separate tab for non-channel plugins
    def add_features(self, id=None, w=None, label=None, color=None, image=None):
        self.feature_options.pack_start(self.wrap_entry(id, w, label, color, image))

    # save config
    def save(self, widget):
        self.save_config(conf.__dict__, "config_")
        self.save_config(conf.plugins, "config_plugins_")
        [callback() for callback in self.hooks["config_save"]]
        conf.save(nice=1)
        self.hide()

Modified gtk3.xml.gz from [540b2b2ee4] to [41b9cff9ce].

cannot compute difference between binary files