def plugins_tab(self, cbs=None): """Construct and layout the plugins tab""" self.plugin_UIManager = self.builder.get_object('plugins_ui_manager') menu_handlers = { "plugin_configure": self.plugin_configure, "plugin_about": self.plugin_about } self.builder.connect_signals(menu_handlers) self.pluginview = self.builder.get_object('plugins_treeview') self.pluginselection = self.pluginview.get_selection() plugindata = self.builder.get_object('plugins_store') self.pluginview.connect('button-press-event', self.plugin_click) plugincheckcell = self.builder.get_object('plugins_check_renderer') plugincheckcell.connect('toggled', self.plugin_toggled, (plugindata, 0)) plugindata.clear() for plugin in pluginsystem.get_info(): pb = self.plugin_get_icon_pixbuf(plugin) plugin_text = "<b>" + plugin.longname + "</b> " + plugin.version_string plugin_text += "\n" + plugin.description enabled = plugin.get_enabled() plugindata.append((enabled, pb, plugin_text))
def plugin_toggled(self, _renderer, path, user_data): model, column = user_data enabled = not model[path][column] plugin = pluginsystem.get_info()[int(path)] pluginsystem.set_enabled(plugin, enabled) if enabled: # test that the plugin loads or already was loaded if not plugin.force_loaded(): enabled = False pluginsystem.set_enabled(plugin, enabled) model[path][column] = enabled
def plugin_get_selected(self): model, i = self.pluginselection.get_selected() plugin_num = model.get_path(i).get_indices()[0] return pluginsystem.get_info()[plugin_num]