Index: st2.py ================================================================== --- st2.py +++ st2.py @@ -18,11 +18,11 @@ # id: streamtuner2 # pack: *.py, gtk*.xml, st2.py=/usr/bin/streamtuner2, channels/__init__.py, bundle/*.py, # streamtuner2.desktop=/usr/share/applications/, README=/usr/share/doc/streamtuner2/, # NEWS.gz=/usr/share/doc/streamtuner2/changelog.gz, help/streamtuner2.1=/usr/share/man/man1/, # help/*page=/usr/share/doc/streamtuner2/help/, help/img/*=/usr/share/doc/streamtuner2/help/img/, -# streamtuner2.png, logo.png=/usr/share/pixmaps/streamtuner2.png, +# logo.png=/usr/share/pixmaps/streamtuner2.png, # architecture: all # # Streamtuner2 is a GUI for browsing internet radio directories, music # collections, and video services - grouped by genres or categories. # It runs your preferred audio player, and streamripper for recording. @@ -93,11 +93,11 @@ # constructor def __init__(self): # Load stylesheet, instantiate GtkBuilder in self, menu and logo hooks - gui_startup(0/20.0), self.load_theme() + 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.extensionsCTM.set_submenu(self.extensions) # duplicates Station>Extension menu into stream context menu self.img_logo.set_from_pixbuf(uikit.pixbuf(logo.png)) @@ -455,20 +455,10 @@ for id in self.channels.keys(): if (self.channels[id]): channelopts[id] = {"current":self.channels[id].current} conf.save("state", channelopts, nice=1) - - # apply gtkrc stylesheet - def load_theme(self): - if conf.get("theme"): - for dir in (conf.dir, conf.share, "/usr/share"): - f = dir + "/themes/" + conf.theme + "/gtk-2.0/gtkrc" - if os.path.exists(f): - gtk.rc_parse(f) - pass - # end application and gtk+ main loop def gtk_main_quit(self, widget, *x): if conf.auto_save_appstate: try: # doesn't work with gtk3 yet (probably just hooking at the wrong time) Index: uikit.py ================================================================== --- uikit.py +++ uikit.py @@ -438,10 +438,21 @@ 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"): p = GdkPixbuf.PixbufLoader(fmt)