def _setup_plugins(self): """ @S_sources are to be included directly in the catalog, @s_souces as just as subitems """ from kupfer.core import plugins s_sources = [] S_sources = [] setctl = settings.GetSettingsController() setctl.connect("plugin-enabled-changed", self._plugin_enabled) for item in plugins.get_plugin_ids(): if not setctl.get_plugin_enabled(item): continue sources = self._load_plugin(item) if setctl.get_plugin_is_toplevel(item): S_sources.extend(sources) else: s_sources.extend(sources) D_dirs, d_dirs = self._get_directory_sources() S_sources.extend(D_dirs) s_sources.extend(d_dirs) if not S_sources and not s_sources: pretty.print_info(__name__, "No sources found!") return S_sources, s_sources
def _load_all_plugins(self): """ Insert all plugin sources into the catalog """ from kupfer.core import plugins setctl = settings.GetSettingsController() for item in sorted(plugins.get_plugin_ids()): if not setctl.get_plugin_enabled(item): continue sources = self._load_plugin(item) self._insert_sources(item, sources, initialize=False)
def _setup_plugins(self): """ @S_sources are to be included directly in the catalog, @s_souces as just as subitems """ from kupfer.core import plugins from kupfer.core.plugins import (load_plugin_sources, sources_attribute, action_decorators_attribute, text_sources_attribute, content_decorators_attribute, initialize_plugin) s_sources = [] S_sources = [] setctl = settings.GetSettingsController() text_sources = [] action_decorators = [] content_decorators = [] for item in plugins.get_plugin_ids(): if not setctl.get_plugin_enabled(item): continue initialize_plugin(item) text_sources.extend(load_plugin_sources(item, text_sources_attribute)) action_decorators.extend(load_plugin_sources(item, action_decorators_attribute)) # Register all Sources as (potential) content decorators content_decorators.extend(load_plugin_sources(item, sources_attribute, instantiate=False)) content_decorators.extend(load_plugin_sources(item, content_decorators_attribute, instantiate=False)) if setctl.get_plugin_is_toplevel(item): S_sources.extend(load_plugin_sources(item)) else: s_sources.extend(load_plugin_sources(item)) D_dirs, d_dirs = self._get_directory_sources() S_sources.extend(D_dirs) s_sources.extend(d_dirs) if not S_sources and not s_sources: pretty.print_info(__name__, "No sources found!") self.register_text_sources(text_sources) self.register_action_decorators(action_decorators) self.register_content_decorators(content_decorators) return S_sources, s_sources