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

⌈⌋ branch:  streamtuner2


Check-in [ad852f14fe]

Overview
Comment:Removed Gtk `theme` configuration options. (Didn't work anymore.) -- Addendum: If anyone has been using this, please drop me a line; it could become a plugin now..
Downloads: Tarball | ZIP archive | SQL archive
Timelines: family | ancestors | descendants | both | trunk
Files: files | file ages | folders
SHA1: ad852f14feaef969b63f3d96f0890fca060d4b4b
User & Date: mario on 2015-04-03 20:46:47
Original Comment: Removed Gtk `theme` configuration options. (Didn't work anymore.)
Other Links: manifest | tags
Context
2015-04-04
01:44
Removed remains of [stop] button handling. Fixed url param in homepage channel callback. check-in: 5692e6ae5d user: mario tags: trunk
2015-04-03
20:46
Removed Gtk `theme` configuration options. (Didn't work anymore.) -- Addendum: If anyone has been using this, please drop me a line; it could become a plugin now.. check-in: ad852f14fe user: mario tags: trunk
20:43
Made channel tabs reorderable. Now kept in config/window.json as `tab_order` and current page saved as `tab_current` instead of pageno. Disabled progressbar changes for ahttp, made search_server search run in a thread so status can be shown. check-in: 6fab0e7170 user: mario tags: trunk
Changes

Modified channels/configwin.py from [b6f7f7a5cd] to [b3b5b37bef].

26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
class configwin (AuxiliaryWindow):


    # Display win_config, pre-fill text fields from global conf. object
    def open(self, widget):
        if self.first_open:
            self.add_plugins()
            self.combobox_theme()
            self.first_open = 0
            self.win_config.resize(565, 625)
        self.load_config(conf.__dict__, "config_")
        self.load_config(conf.plugins, "config_plugins_")
        [callback() for callback in self.hooks["config_load"]]
        self.win_config.show_all()
    first_open = 1







<







26
27
28
29
30
31
32

33
34
35
36
37
38
39
class configwin (AuxiliaryWindow):


    # Display win_config, pre-fill text fields from global conf. object
    def open(self, widget):
        if self.first_open:
            self.add_plugins()

            self.first_open = 0
            self.win_config.resize(565, 625)
        self.load_config(conf.__dict__, "config_")
        self.load_config(conf.plugins, "config_plugins_")
        [callback() for callback in self.hooks["config_load"]]
        self.win_config.show_all()
    first_open = 1
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
        m = re.search("(?![$(`])\S+", v)
        if m and m.group(0) and find_executable(m.group(0)):
            return gtk.STOCK_MEDIA_PLAY
        else:
            return gtk.STOCK_CANCEL
        

    # list of Gtk themes in dropdown
    def combobox_theme(self):
        # find themes
        themedirs = (conf.share+"/themes", conf.dir+"/themes", "/usr/share/themes")
        themes = ["no theme"]
        [[themes.append(e) for e in os.listdir(dir)] for dir in themedirs if os.path.exists(dir)]
        __print__(dbg.STAT, themes)
        # add dropdown
        self.widgets["theme"] = ComboBoxText(themes)
        self.theme_cb_placeholder.pack_start(self.theme)
        self.theme_cb_placeholder.pack_end(uikit.label(""))


    # retrieve currently selected value
    def apply_theme(self):
        conf.theme = self.theme.get_active_text()
        uikit.load_theme(conf.theme)


    # iterate over channel and feature plugins
    def add_plugins(self):
        ls = {}
        for name in module_list():
            if name in self.channels:
                ls[name] = self.channels[name].meta







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







101
102
103
104
105
106
107


















108
109
110
111
112
113
114
        m = re.search("(?![$(`])\S+", v)
        if m and m.group(0) and find_executable(m.group(0)):
            return gtk.STOCK_MEDIA_PLAY
        else:
            return gtk.STOCK_CANCEL
        




















    # iterate over channel and feature plugins
    def add_plugins(self):
        ls = {}
        for name in module_list():
            if name in self.channels:
                ls[name] = self.channels[name].meta
185
186
187
188
189
190
191
192
193
194
195
        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"]]
        self.apply_theme()
        conf.save(nice=1)
        self.hide()








<



166
167
168
169
170
171
172

173
174
175
        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()

Modified config.py from [2f8e9d09d8] to [81150f5776].

136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
        self.max_streams = "500"
        self.show_bookmarks = 1
        self.show_favicons = 1
        self.load_favicon = 1
        self.heuristic_bookmark_update = 0
        self.retain_deleted = 0
        self.auto_save_appstate = 1
        self.theme = "" #"MountainDew"
        self.reuse_m3u = 1
        self.google_homepage = 0
        self.windows = platform.system()=="Windows"
        self.pyquery = 1
        self.debug = 0

        







<







136
137
138
139
140
141
142

143
144
145
146
147
148
149
        self.max_streams = "500"
        self.show_bookmarks = 1
        self.show_favicons = 1
        self.load_favicon = 1
        self.heuristic_bookmark_update = 0
        self.retain_deleted = 0
        self.auto_save_appstate = 1

        self.reuse_m3u = 1
        self.google_homepage = 0
        self.windows = platform.system()=="Windows"
        self.pyquery = 1
        self.debug = 0

        

Modified gtk3.xml from [803063bf6c] to [51c9fcecae].

351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404






405
406
407
408
409
410
411
                              <packing>
                                <property name="expand">True</property>
                                <property name="fill">True</property>
                                <property name="position">3</property>
                              </packing>
                            </child>
                            <child>
                              <object class="GtkLabel" id="label45">
                                <property name="visible">True</property>
                                <property name="can_focus">False</property>
                                <property name="tooltip_text" translatable="yes">needs restart</property>
                                <property name="xalign">0</property>
                                <property name="label" translatable="yes">Use specific Gtk+ theme for Streamtuner2.</property>
                              </object>
                              <packing>
                                <property name="expand">True</property>
                                <property name="fill">True</property>
                                <property name="padding">5</property>
                                <property name="position">4</property>
                              </packing>
                            </child>
                            <child>
                              <object class="GtkHBox" id="theme_cb_placeholder">
                                <property name="visible">True</property>
                                <property name="can_focus">False</property>
                                <child>
                                  <placeholder/>
                                </child>
                                <child>
                                  <placeholder/>
                                </child>
                              </object>
                              <packing>
                                <property name="expand">False</property>
                                <property name="fill">False</property>
                                <property name="position">5</property>
                              </packing>
                            </child>
                            <child>
                              <object class="GtkCheckButton" id="config_auto_save_appstate">
                                <property name="label" translatable="yes">Save window state, sizes and selections automatically.</property>
                                <property name="visible">True</property>
                                <property name="can_focus">True</property>
                                <property name="receives_default">False</property>
                                <property name="xalign">0</property>
                                <property name="draw_indicator">True</property>
                              </object>
                              <packing>
                                <property name="expand">True</property>
                                <property name="fill">True</property>
                                <property name="padding">5</property>
                                <property name="position">6</property>
                              </packing>
                            </child>






                            <child>
                              <placeholder/>
                            </child>
                            <child>
                              <object class="GtkLabel" id="label2spc3">
                                <property name="visible">True</property>
                                <property name="can_focus">False</property>







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












|


>
>
>
>
>
>







351
352
353
354
355
356
357
































358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
                              <packing>
                                <property name="expand">True</property>
                                <property name="fill">True</property>
                                <property name="position">3</property>
                              </packing>
                            </child>
                            <child>
































                              <object class="GtkCheckButton" id="config_auto_save_appstate">
                                <property name="label" translatable="yes">Save window state, sizes and selections automatically.</property>
                                <property name="visible">True</property>
                                <property name="can_focus">True</property>
                                <property name="receives_default">False</property>
                                <property name="xalign">0</property>
                                <property name="draw_indicator">True</property>
                              </object>
                              <packing>
                                <property name="expand">True</property>
                                <property name="fill">True</property>
                                <property name="padding">5</property>
                                <property name="position">4</property>
                              </packing>
                            </child>
                            <child>
                              <placeholder/>
                            </child>
                            <child>
                              <placeholder/>
                            </child>
                            <child>
                              <placeholder/>
                            </child>
                            <child>
                              <object class="GtkLabel" id="label2spc3">
                                <property name="visible">True</property>
                                <property name="can_focus">False</property>

Modified st2.py from [5fd894f832] to [f58549c2df].

88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
    # status variables
    current_channel = "bookmarks"    # currently selected channel name (as index in self.channels{})

    # constructor
    def __init__(self):
        
        # Load stylesheet, instantiate GtkBuilder in self, menu and logo hooks
        gui_startup(0/20.0), uikit.load_theme(conf.get("theme"))
        gui_startup(1/20.0), gtk.Builder.__init__(self)
        gui_startup(1/20.0), gtk.Builder.add_from_string(self, ui_xml)
        gui_startup(3/20.0), self.img_logo.set_from_pixbuf(uikit.pixbuf(logo.png))

        # initialize built-in plugins
        self.channels = {
          "bookmarks": channels.bookmarks.bookmarks(parent=self),   # this the remaining built-in channel







<







88
89
90
91
92
93
94

95
96
97
98
99
100
101
    # status variables
    current_channel = "bookmarks"    # currently selected channel name (as index in self.channels{})

    # constructor
    def __init__(self):
        
        # Load stylesheet, instantiate GtkBuilder in self, menu and logo hooks

        gui_startup(1/20.0), gtk.Builder.__init__(self)
        gui_startup(1/20.0), gtk.Builder.add_from_string(self, ui_xml)
        gui_startup(3/20.0), self.img_logo.set_from_pixbuf(uikit.pixbuf(logo.png))

        # initialize built-in plugins
        self.channels = {
          "bookmarks": channels.bookmarks.bookmarks(parent=self),   # this the remaining built-in channel

Modified uikit.py from [2c0d4193cf] to [e7bfffdeb1].

447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
    # gtk.messagebox
    @staticmethod
    def msg(text, style=gtk.MESSAGE_INFO, buttons=gtk.BUTTONS_CLOSE):
        m = gtk.MessageDialog(None, 0, style, buttons, message_format=text)
        m.show()
        m.connect("response", lambda *w: m.destroy())
        

    # apply gtkrc stylesheet
    @staticmethod
    def load_theme(theme=None):
        if theme:
            for dir in (conf.dir, conf.share, "/usr/share"):
                f = dir + "/themes/" + theme + "/gtk-2.0/gtkrc"
                if os.path.exists(f):
                    gtk.rc_parse(f)
            pass

        
    # Pixbug loader (from inline string, as in `logo.png`)
    @staticmethod
    def pixbuf(buf, fmt="png", decode=True, gzip=False):
        if not buf or len(buf) < 16:
            return None
        if fmt and ver==3:







<
<
<
<
<
<
<
<
<
<
<







447
448
449
450
451
452
453











454
455
456
457
458
459
460
    # gtk.messagebox
    @staticmethod
    def msg(text, style=gtk.MESSAGE_INFO, buttons=gtk.BUTTONS_CLOSE):
        m = gtk.MessageDialog(None, 0, style, buttons, message_format=text)
        m.show()
        m.connect("response", lambda *w: m.destroy())
        











        
    # Pixbug loader (from inline string, as in `logo.png`)
    @staticmethod
    def pixbuf(buf, fmt="png", decode=True, gzip=False):
        if not buf or len(buf) < 16:
            return None
        if fmt and ver==3: