当前位置: 首页>>代码示例>>Python>>正文


Python PluginEngine.recheck_plugin_errors方法代码示例

本文整理汇总了Python中GTG.core.plugins.engine.PluginEngine.recheck_plugin_errors方法的典型用法代码示例。如果您正苦于以下问题:Python PluginEngine.recheck_plugin_errors方法的具体用法?Python PluginEngine.recheck_plugin_errors怎么用?Python PluginEngine.recheck_plugin_errors使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在GTG.core.plugins.engine.PluginEngine的用法示例。


在下文中一共展示了PluginEngine.recheck_plugin_errors方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。

示例1: __init__

# 需要导入模块: from GTG.core.plugins.engine import PluginEngine [as 别名]
# 或者: from GTG.core.plugins.engine.PluginEngine import recheck_plugin_errors [as 别名]
class PluginsDialog:
    """ Dialog for Plugins configuration """

    def __init__(self, config_obj):
        self.config_obj = config_obj
        self.config = self.config_obj.get_subconfig("plugins")
        builder = Gtk.Builder()
        builder.add_from_file(ViewConfig.PLUGINS_UI_FILE)

        self.dialog = builder.get_object("PluginsDialog")
        self.dialog.set_title(_("Plugins - %s" % info.NAME))
        self.plugin_tree = builder.get_object("PluginTree")
        self.plugin_configure = builder.get_object("plugin_configure")
        self.plugin_about = builder.get_object("PluginAboutDialog")
        self.plugin_depends = builder.get_object('PluginDepends')

        help.add_help_shortcut(self.dialog, "plugins")

        self.pengine = PluginEngine()
        # plugin config initiation
        if self.pengine.get_plugins():
            self.config.set(
                "disabled",
                [p.module_name for p in self.pengine.get_plugins("disabled")],
            )
            self.config.set(
                "enabled",
                [p.module_name for p in self.pengine.get_plugins("enabled")],
            )

        # see constants PLUGINS_COL_* for column meanings
        self.plugin_store = Gtk.ListStore(str, bool, str, str, bool)

        builder.connect_signals({
                                'on_plugins_help':
                                self.on_help,
                                'on_plugins_close':
                                self.on_close,
                                'on_PluginsDialog_delete_event':
                                self.on_close,
                                'on_PluginTree_cursor_changed':
                                self.on_plugin_select,
                                'on_plugin_about':
                                self.on_plugin_about,
                                'on_plugin_configure':
                                self.on_plugin_configure,
                                'on_PluginAboutDialog_close':
                                self.on_plugin_about_close,
                                })

    def _init_plugin_tree(self):
        """ Initialize the PluginTree Gtk.TreeView.

        The format is modelled after the one used in gedit; see
        http://git.gnome.org/browse/gedit/tree/gedit/gedit-plugin-mapnager.c
        """
        # force creation of the Gtk.ListStore so we can reference it
        self._refresh_plugin_store()

        # renderer for the toggle column
        renderer = Gtk.CellRendererToggle()
        renderer.set_property('xpad', 6)
        renderer.connect('toggled', self.on_plugin_toggle)
        # toggle column
        column = Gtk.TreeViewColumn(None, renderer, active=PLUGINS_COL_ENABLED,
                                    activatable=PLUGINS_COL_ACTIVATABLE,
                                    sensitive=PLUGINS_COL_ACTIVATABLE)
        self.plugin_tree.append_column(column)

        # plugin name column
        column = Gtk.TreeViewColumn()
        column.set_spacing(6)
        # icon renderer for the plugin name column
        icon_renderer = Gtk.CellRendererPixbuf()
        icon_renderer.set_property('stock-size', Gtk.IconSize.SMALL_TOOLBAR)
        icon_renderer.set_property('xpad', 3)
        column.pack_start(icon_renderer, False)
        column.set_cell_data_func(icon_renderer, plugin_icon)
        # text renderer for the plugin name column
        name_renderer = Gtk.CellRendererText()
        name_renderer.set_property('ellipsize', Pango.EllipsizeMode.END)
        column.pack_start(name_renderer, True)
        column.set_cell_data_func(name_renderer, plugin_markup, self)

        self.plugin_tree.append_column(column)

        # finish setup
        self.plugin_tree.set_model(self.plugin_store)
        self.plugin_tree.set_search_column(2)

    def _refresh_plugin_store(self):
        """ Refresh status of plugins and put it in a Gtk.ListStore """
        self.plugin_store.clear()
        self.pengine.recheck_plugin_errors(True)
        for name, plugin in self.pengine.plugins.items():
            # activateable if there is no error
            self.plugin_store.append((name, plugin.enabled, plugin.full_name,
                                      plugin.short_description,
                                      not plugin.error))

#.........这里部分代码省略.........
开发者ID:Ethcelon,项目名称:gtg,代码行数:103,代码来源:plugins.py

示例2: __init__

# 需要导入模块: from GTG.core.plugins.engine import PluginEngine [as 别名]
# 或者: from GTG.core.plugins.engine.PluginEngine import recheck_plugin_errors [as 别名]
class PreferencesDialog:

    __AUTOSTART_DIRECTORY = os.path.join(xdg_config_home, "autostart")
    __AUTOSTART_FILE = "gtg.desktop"

    def __init__(self, config_obj):
        """Constructor."""
        self.config_obj = config_obj
        self.config = self.config_obj.conf_dict
        self.builder = gtk.Builder() 
        self.builder.add_from_file(ViewConfig.PREFERENCES_GLADE_FILE)
        # store references to some objects
        widgets = {
          'dialog': 'PreferencesDialog',
          'backend_tree': 'BackendTree',
          'plugin_tree': 'PluginTree',
          'plugin_about_dialog': 'PluginAboutDialog',
          'plugin_configure': 'plugin_configure',
          'plugin_depends': 'PluginDepends',
          'plugin_config_dialog': 'PluginConfigDialog',
          'pref_autostart': 'pref_autostart',
          'pref_show_preview': 'pref_show_preview'
          }
        for attr, widget in widgets.iteritems():
            setattr(self, attr, self.builder.get_object(widget))
        # keep a reference to the parent task browser
        #FIXME: this is not needed and should be removed
#        self.tb = taskbrowser
        self.pengine = PluginEngine()
        # initialize tree models
        self._init_backend_tree()
        # this can't happen yet, due to the order of things in
        #  TaskBrowser.__init__(). Happens in activate() instead.
        # self._init_plugin_tree()
        pref_signals_dic = self.get_signals_dict()
        self.builder.connect_signals(pref_signals_dic)

    def _init_backend_tree(self):
        """Initialize the BackendTree gtk.TreeView."""
        self._refresh_backend_store()
        # TODO

    def _refresh_backend_store(self):
        """Populate a gtk.ListStore with backend information."""
        # create and clear a gtk.ListStore for backend information
        if not hasattr(self, 'backend_store'):
            # TODO: create the liststore. It should have one column for each
            # backend.
            self.backend_store = gtk.ListStore(str)
        self.backend_store.clear()
        # TODO

    def _refresh_plugin_store(self):
        """Populate a gtk.ListStore with plugin information."""
        # create and clear a gtk.ListStore
        if not hasattr(self, 'plugin_store'):
            # see constants PLUGINS_COL_* for column meanings
            self.plugin_store = gtk.ListStore(str, 'gboolean', str, str, str,
              'gboolean',)
        self.plugin_store.clear()
        # refresh the status of all plugins
        self.pengine.recheck_plugin_errors(True)
        # repopulate the store
        for name, p in self.pengine.plugins.iteritems():
            self.plugin_store.append([name, p.enabled, p.full_name,
              p.short_description, p.description, not p.error,]) # activateable if there is no error

    def  _refresh_preferences_store(self):
        """Sets the correct value in the preferences checkboxes"""
        autostart_path = os.path.join(self.__AUTOSTART_DIRECTORY, \
                                      self.__AUTOSTART_FILE)
        self.pref_autostart.set_active(os.path.isfile(autostart_path))
        #This set_active method doesn't even understand what a boolean is!
        #what a PITA !
        if self.config_priv.get("contents_preview_enable"):
            toset = 1
        else:
            toset = 0
        self.pref_show_preview.set_active(toset)


    def _init_plugin_tree(self):
        """Initialize the PluginTree gtk.TreeView.
        
        The format is modelled after the one used in gedit; see
        http://git.gnome.org/browse/gedit/tree/gedit/gedit-plugin-mapnager.c
        
        """
        # force creation of the gtk.ListStore so we can reference it
        self._refresh_plugin_store()

        # renderer for the toggle column
        renderer = gtk.CellRendererToggle()
        renderer.set_property('xpad', 6)
        renderer.connect('toggled', self.on_plugin_toggle)
        # toggle column
        column = gtk.TreeViewColumn(None, renderer, active=PLUGINS_COL_ENABLED,
          activatable=PLUGINS_COL_ACTIVATABLE,
          sensitive=PLUGINS_COL_ACTIVATABLE)
        self.plugin_tree.append_column(column)
#.........这里部分代码省略.........
开发者ID:dneelyep,项目名称:Programming-Directory,代码行数:103,代码来源:preferences.py


注:本文中的GTG.core.plugins.engine.PluginEngine.recheck_plugin_errors方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。