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

⌈⌋ ⎇ branch:  streamtuner2


Diff

Differences From Artifact [55e5421a33]:

To Artifact [227cef2658]:


97
98
99
100
101
102
103
104
105
106

107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
    # for each ListStore column id.)
    def list_edit(self, liststore, path, column, new_text):
        liststore[path][column] = new_text
        liststore[path][3] = self.app_bin_check(new_text)

    # return OK or CANCEL depending on availability of app
    def app_bin_check(self, v):
        m = re.search("(?![$(`])\S+", v)
        if m and m.group(0):
            if find_executable(m.group(0)):

                return gtk.STOCK_MEDIA_PLAY
            else:
                return gtk.STOCK_CANCEL
        else:
            return gtk.STOCK_NEW
        


    # iterate over channel and feature plugins
    def add_plugins(self):
        ls = dict([(name, plugin_meta(module=name)) for name in module_list()])
        #for name in module_list():
        #    if name in self.channels:
        #        ls[name] = self.channels[name].meta
        #    elif name in self.features:
        #        ls[name] = self.features[name].meta
        #    else:
        #        ls[name] = plugin_meta(module=name)







|
|
|
>










|







97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
    # for each ListStore column id.)
    def list_edit(self, liststore, path, column, new_text):
        liststore[path][column] = new_text
        liststore[path][3] = self.app_bin_check(new_text)

    # return OK or CANCEL depending on availability of app
    def app_bin_check(self, v):
        bin = re.findall(r"(?<![$(`%-])\b(\w+(?:-\w+)*)", v)
        if bin:
            bin = [find_executable(bin) for bin in bin]
            if not None in bin:
                return gtk.STOCK_MEDIA_PLAY
            else:
                return gtk.STOCK_CANCEL
        else:
            return gtk.STOCK_NEW
        


    # iterate over channel and feature plugins
    def add_plugins(self):
        ls = {name: plugin_meta(module=name) for name in module_list()}
        #for name in module_list():
        #    if name in self.channels:
        #        ls[name] = self.channels[name].meta
        #    elif name in self.features:
        #        ls[name] = self.features[name].meta
        #    else:
        #        ls[name] = plugin_meta(module=name)
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
196
197
198
199
200
201
202
203
            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, 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, 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, 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()








<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<



|



|









161
162
163
164
165
166
167




















168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
            else:
                add_( "config_"+opt["name"], gtk.Entry(), opt["description"], color )

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























    # Put config widgets into channels/features configwin notebooks
    def add_channels(self, id=None, w=None, label=None, color=None, image=None, align=20):
        self.plugin_options.pack_start(uikit.wrap(self.widgets, 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, align=20):
        self.feature_options.pack_start(uikit.wrap(self.widgets, 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()