예제 #1
0
 def select_plugin(self, uri):
     """Select plugin callback"""
     params = self.parent().collector_uri_call(uri)
     if params is not None:
         plugin = params.get('plugin', None)
         if plugin is not None:
             man = get_manager('plugin')
             self.hide()
             try:
                 man.get(plugin).run()
                 self.done(1)
             except Exception as exc:
                 logging.exception(exc)
                 self.done(-1)
예제 #2
0
    def customize(self):
        self.label_noplugins.hide()
        plugins = self.get_plugins()
        man = get_manager('plugin')
        items = []
        for i in plugins:
            plugin = man.get(i)
            items.append(
                {'class': 'link', 'name': plugin.get_name(),
                 'path': 'plugin/' + plugin.get_id(),
                 'image': plugin.icon}
            )

        # Toolbar
        items.append({'class': 'spacer'})
        CustomToolbar(self.toolbar, items, self.select_plugin)
        if not len(plugins):
            self.toolbar.hide()
            self.label_noplugins.show()
예제 #3
0
 def get_plugins(self):
     plugins = get_manager('plugin').filter(self.filter_)
     return plugins