Index: st2.py ================================================================== --- st2.py +++ st2.py @@ -14,13 +14,13 @@ # { type: env, name: http_proxy, description: proxy for HTTP access } # { type: env, name: XDG_CONFIG_HOME, description: relocates user .config subdirectory } # category: sound # depends: pygtk | gi, threading, requests, pyquery, lxml # id: streamtuner2 -# pack: *.py, gtk3.xml.zlib, bin, channels/__init__.py, bundle/*.py, CREDITS, help/index.page, +# pack: *.py, gtk3.xml.gz, bin, channels/__init__.py, bundle/*.py, CREDITS, help/index.page, # streamtuner2.desktop, README, help/streamtuner2.1=/usr/share/man/man1/, -# NEWS.gz=/usr/share/doc/streamtuner2/changelog.gz, logo.png=/usr/share/pixmaps/streamtuner2.png +# NEWS.gz=/usr/share/doc/streamtuner2/changelog.gz, icon.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. @@ -72,11 +72,10 @@ # object containers widgets = {} # non-glade widgets (the manually instantiated ones) channels = {} # channel modules features = {} # non-channel plugins working = [] # threads - add_signals = {} # channel gtk-handler signals hooks = { "play": [favicon.download_playing], # observers queue here "init": [], "config_load": [], "config_save": [], @@ -91,11 +90,11 @@ 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)) + gui_startup(3/20.0), self.img_logo.set_from_pixbuf(uikit.pixbuf(logo.png, decode=1, fmt="png")) # initialize built-in plugins self.channels = { "bookmarks": channels.bookmarks.bookmarks(parent=self), # this the remaining built-in channel } @@ -141,11 +140,11 @@ except: __print__(dbg.INIT, "main.__init__: current_channel.first_show() initialization error") # bind gtk/glade event names to functions gui_startup(19.75/20.0) - self.connect_signals(dict({ + self.connect_signals({ "gtk_main_quit" : self.gtk_main_quit, # close window # treeviews / notebook "on_stream_row_activated" : self.on_play_clicked, # double click in a streams list "on_category_clicked": self.on_category_clicked, # new selection in category list "on_notebook_channels_switch_page": self.channel_switch, # channel notebook tab changed @@ -200,13 +199,14 @@ # win_streamedit "streamedit_open": self.streamedit.open, "streamedit_save": self.streamedit.save, "streamedit_new": self.streamedit.new, "streamedit_cancel": self.streamedit.cancel, - }, **self.add_signals)) + }) # actually display main window + self.update_title() self.win_streamtuner2.show_all() gui_startup(100.0) #-- Shortcut for glade.get_widget() @@ -245,10 +245,11 @@ # Notebook tab has been clicked (receives numeric page_num), but *NOT* yet changed (visually). def channel_switch(self, notebook, page, page_num=0, *args): self.current_channel = notebook.get_menu_label_text(notebook.get_nth_page(page_num)) __print__(dbg.UI, "main.channel_switch():", "set current_channel :=", self.current_channel) + self.update_title() # if first selected, load current category __print__(dbg.STAT, "TRY", "main.channel_switch(): ", self.current_channel + ".first_show()") try: self.channel().first_show() except: __print__(dbg.INIT, ".first_show() initialization error") @@ -255,10 +256,14 @@ # Invoked from the menu instead, uses module name instead of numeric tab id def channel_switch_by_name(self, name): self.notebook_channels.set_current_page(self.channel_names.index(name)) + # Mirror selected channel tab into main window title + def update_title(self): + self.win_streamtuner2.set_title("Streamtuner2 - %s" % self.channel().meta.get("title")) + # Convert ListStore iter to row number def rowno(self): (model, iter) = self.model_iter() return model.get_path(iter)[0]