Exemple #1
0
	def _load_plugin(self, plugin_id):
		"""
		Load @plugin_id, register all its Actions, Content and TextSources.
		Return its sources.
		"""
		with pluginload.exception_guard(plugin_id):
			plugin = pluginload.load_plugin(plugin_id)
			self.register_text_sources(plugin.text_sources)
			self.register_action_decorators(plugin.action_decorators)
			self.register_content_decorators(plugin.content_decorators)
			return set(plugin.sources)
		return set()
Exemple #2
0
 def _load_plugin(self, plugin_id):
     """
     Load @plugin_id, register all its Actions, Content and TextSources.
     Return its sources.
     """
     with pluginload.exception_guard(plugin_id):
         plugin = pluginload.load_plugin(plugin_id)
         self.register_text_sources(plugin_id, plugin.text_sources)
         self.register_action_decorators(plugin_id, plugin.action_decorators)
         self.register_content_decorators(plugin_id, plugin.content_decorators)
         self.register_action_generators(plugin_id, plugin.action_generators)
         return set(plugin.sources)
     return set()
Exemple #3
0
 def get_contents_for_leaf(self, leaf, types=None):
     """Iterator of content sources for @leaf,
     providing @types (or None for all)"""
     for typ in self.content_decorators:
         if not isinstance(leaf, typ):
             continue
         for content in list(self.content_decorators[typ]):
             dsrc = None
             with pluginload.exception_guard(content,
                                             self._remove_source,
                                             content,
                                             is_decorator=True):
                 dsrc = content.decorate_item(leaf)
             if dsrc:
                 if types and not self.good_source_for_types(dsrc, types):
                     continue
                 yield self.get_canonical_source(dsrc)
Exemple #4
0
	def _cache_sources(self, sources):
		# Make sure that the toplevel sources are chached
		# either newly rescanned or the cache is fully loaded
		for src in set(sources):
			with pluginload.exception_guard(src, self._remove_source, src):
				self.rescanner.rescan_now(src, force_update=False)
Exemple #5
0
	def _initialize_sources(self, sources):
		for src in set(sources):
			with pluginload.exception_guard(src, self._remove_source, src):
				src.initialize()
Exemple #6
0
 def _cache_sources(self, sources):
     # Make sure that the toplevel sources are chached
     # either newly rescanned or the cache is fully loaded
     for src in set(sources):
         with pluginload.exception_guard(src, self._remove_source, src):
             self.rescanner.rescan_now(src, force_update=False)
Exemple #7
0
 def _initialize_sources(self, sources):
     for src in set(sources):
         with pluginload.exception_guard(src, self._remove_source, src):
             src.initialize()