Logo Search packages:      
Sourcecode: viridian version File versions  Download package

def AmpacheTools::AmpacheGUI::AmpacheGUI::show_plugins_window (   self,
  args 
)
The Plugins Window

Definition at line 1608 of file AmpacheGUI.py.

                                          :
            """The Plugins Window"""
01611             #################################
            # The Plugins Window
            #################################
            if hasattr(self, 'plugins_window'):
                  if self.plugins_window != None:
                        self.plugins_window.present()
                        return True
                        
            self.plugins_window = gtk.Window(gtk.WINDOW_TOPLEVEL)
            self.plugins_window.set_transient_for(self.window)
            self.plugins_window.set_position(gtk.WIN_POS_CENTER_ON_PARENT)
            self.plugins_window.resize(490, 300)
            self.plugins_window.set_resizable(True)
            self.plugins_window.set_icon(self.images_pixbuf_viridian_simple)
            self.plugins_window.connect("delete_event", self.destroy_plugins_window)
            self.plugins_window.connect("destroy", self.destroy_plugins_window)           
            self.plugins_window.set_title(_("Viridian Plugins"))
            
            vbox = gtk.VBox()
            vbox.set_border_width(10)

            hbox = gtk.HBox()
            hbox.pack_start(gtk.Label(_("Select a plugin.")), False, False, 2)
            vbox.pack_start(hbox, False, False, 2)

            scrolled_window = gtk.ScrolledWindow()
            scrolled_window.set_shadow_type(gtk.SHADOW_ETCHED_IN)
            scrolled_window.set_policy(gtk.POLICY_AUTOMATIC, gtk.POLICY_AUTOMATIC)
            
            list_store = gtk.ListStore(gobject.TYPE_BOOLEAN, str, str, str)
            treeview = gtk.TreeView(list_store)

            bool_cell_renderer = gtk.CellRendererToggle()
            bool_cell_renderer.set_property('activatable', True)
            bool_cell_renderer.connect('toggled', self.toggle_plugin, list_store)
            bool_col = gtk.TreeViewColumn(_("Enabled"), bool_cell_renderer, active=0)
            treeview.append_column(bool_col)
            
            renderer_text = gtk.CellRendererText()
            name_column = gtk.TreeViewColumn(_("Name"), renderer_text, text=1)
            treeview.append_column(name_column)

            renderer_text = gtk.CellRendererText()
            desc_column = gtk.TreeViewColumn(_("Description"), renderer_text, text=2)
            treeview.append_column(desc_column)
            
            # Check for new plugins since launch
            self.plugins = {}
            new_plugins_list = self.__find_plugins(PLUGINS_DIR)
            for plugin in new_plugins_list:
                  imported_plugin = self.__import_plugin(plugin)
                  if imported_plugin != None:
                        self.plugins[plugin] = imported_plugin
                        
            for name, plugin in self.plugins.iteritems():
                  enabled = False
                  if name in self.enabled_plugins:
                        enabled = True
                  try:
                        title       = plugin.title
                        description = plugin.description
                        author      = plugin.author
                        list_store.append((enabled, title, description, name))
                  except:
                        print _("Error: plugin '%s' could not be loaded because it is missing a title, description, and author instance variable") % (name)
            
            
            scrolled_window.add(treeview)

            vbox.pack_start(scrolled_window, True, True, 5)
            
            bottom_bar = gtk.HBox()
            
            close = gtk.Button(stock=gtk.STOCK_CLOSE)
            close.connect("clicked", self.destroy_plugins_window)
            
            bottom_bar.pack_end(close, False, False, 2)

            vbox.pack_start(bottom_bar, False, False, 1)

            self.plugins_window.add(vbox)
            
            self.plugins_window.show_all()
            
            

Generated by  Doxygen 1.6.0   Back to index