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

⌈⌋ ⎇ branch:  streamtuner2


Diff

Differences From Artifact [905b0713ca]:

To Artifact [55e5421a33]:


135
136
137
138
139
140
141



142
143


144
145
146
147
148
149
150
135
136
137
138
139
140
141
142
143
144


145
146
147
148
149
150
151
152
153







+
+
+
-
-
+
+







                + "<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")))
        doc = meta.get("doc", "").strip()
        if ver < 3:
            doc = re.sub("(?<=\S) *\n(?! *\n)", " ", doc)
        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"))
        cb.set_tooltip_text(doc)
        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)
            # display checkbox
            if opt["type"] == "boolean":
                cb = gtk.CheckButton(opt["description"])
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
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
196
197
198
199
200
201
202
203







-
+












+
+
+
+
+



-
-
+
+


-
-
+
+









                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):
    def wrap_entry(self, id, w, label, color, image, align=1):
        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)
        if align:
            a = gtk.Alignment()
            a.set_padding(0, 0, align, 0)
            a.add(w)
            w = a
        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))
    def add_channels(self, id=None, w=None, label=None, color=None, image=None, align=20):
        self.plugin_options.pack_start(self.wrap_entry(id, w, label, color, image, align))

    # 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))
    def add_features(self, id=None, w=None, label=None, color=None, image=None, align=20):
        self.feature_options.pack_start(self.wrap_entry(id, w, label, color, image, align))

    # 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()