Index: channels/__init__.py ================================================================== --- channels/__init__.py +++ channels/__init__.py @@ -132,10 +132,13 @@ self.module = self.__class__.__name__ self.meta = plugin_meta(None, inspect.getcomments(inspect.getmodule(self))) self.config = self.meta.get("config", []) self.title = self.meta.get("title", self.module) + # add default options values to config.conf.* dict + conf.add_plugin_defaults(self.meta["config"], self.module) + # only if streamtuner2 is run in graphical mode if (parent): self.cache() self.gui(parent) pass @@ -195,11 +198,11 @@ self.load(self.current) else: uikit.columns(self.gtk_list, self.datamap, []) # add to main menu - uikit.add_menu(parent.channelmenuitems, self.meta["title"], lambda w: parent.channel_switch(w, self.module) or 1) + uikit.add_menu([parent.channelmenuitems], self.meta["title"], lambda w: parent.channel_switch(w, self.module) or 1) # make private copy of .datamap and modify field (title= only ATM) def update_datamap(self, search="name", title=None): if self.datamap == GenericChannel.datamap: @@ -586,11 +589,11 @@ # try to initialize superclass now, before adding to channel tabs GenericChannel.gui(self, parent) # add notebook tab - tab = parent.notebook_channels.insert_page_menu(child=vbox, tab_label=ev_label, menu_label=plain_label) + tab = parent.notebook_channels.insert_page_menu(vbox, ev_label, plain_label, -1) # double-click catch Index: st2.py ================================================================== --- st2.py +++ st2.py @@ -96,12 +96,11 @@ # 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.extensionsCTM.set_submenu(self.extensions) # duplicates Station>Extension menu into stream context menu - 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)) # initialize built-in plugins self.channels = { "bookmarks": channels.bookmarks.bookmarks(parent=self), # this the remaining built-in channel } @@ -211,12 +210,12 @@ "streamedit_cancel": self.streamedit.cancel, }, **self.add_signals)) # actually display main window self.win_streamtuner2.show_all() - gui_startup(1.0) - + gui_startup(100.0) + #-- Shortcut for glade.get_widget() # Allows access to widgets as direct attributes instead of using .get_widget() # Also looks in self.channels[] for the named channel plugins def __getattr__(self, name): @@ -391,11 +390,11 @@ while ((not text) and (type(text)==str) and len(sbar_msg)): sbar_msg.pop() uikit.do(lambda:self.statusbar.pop(sbar_cid)) # progressbar if (type(text)==float): - if (text >= 999.0/1000): # completed + if text >= 0.999 or text < 0.0: # completed uikit.do(lambda:self.progress.hide()) else: # show percentage uikit.do(lambda:self.progress.show_all() or self.progress.set_fraction(text)) if (text <= 0): # unknown state uikit.do(lambda:self.progress.pulse()) @@ -426,30 +425,24 @@ try: plugin = __import__("channels."+module, globals(), None, [""]) #print [name for name,c in inspect.getmembers(plugin) if inspect.isclass(c)] plugin_class = plugin.__dict__[module] plugin_obj = plugin_class(parent=self) - - # load .config settings from plugin - conf.add_plugin_defaults(plugin_obj.meta["config"], module) - # add and initialize channel + # add to .channels{} if issubclass(plugin_class, channels.GenericChannel): self.channels[module] = plugin_obj if module not in self.channel_names: # skip (glade) built-in channels self.channel_names.append(module) - # other plugin types + # or .features{} for other plugin types else: self.features[module] = plugin_obj except Exception as e: __print__(dbg.INIT, "load_plugin_channels: error initializing:", module, ", exception:") traceback.print_exc() - # default plugins - conf.add_plugin_defaults(self.channels["bookmarks"].config, "bookmarks") - # store window/widget states (sizes, selections, etc.) def app_state(self, widget): # gtk widget states widgetnames = ["win_streamtuner2", "toolbar", "notebook_channels", ] \