33 from python_qt_binding.QtCore
import qCritical
39 """Composite of multiple `PluginProvider`s.""" 42 super(CompositePluginProvider, self).
__init__()
43 self.setObjectName(
'CompositePluginProvider')
54 discovered_plugins = []
57 plugin_descriptors = plugin_provider.discover(discovery_data)
60 'CompositePluginProvider.discover() could not discover plugins from ' 61 'provider "%s":\n%s' % (type(plugin_provider), traceback.format_exc()))
64 discovered_plugins += plugin_descriptors
65 return discovered_plugins
67 def load(self, plugin_id, plugin_context):
69 for plugin_provider, plugin_descriptors
in self._discovered_plugins.items():
70 for plugin_descriptor
in plugin_descriptors:
71 if plugin_descriptor.plugin_id() == plugin_id:
72 instance = plugin_provider.load(plugin_id, plugin_context)
75 raise UserWarning(
'plugin_id "%s" not found' % plugin_id)
81 self._running_plugins.pop(plugin_instance)
83 raise UserWarning(
'plugin_instance not found')
87 plugin_provider.shutdown()
def load(self, plugin_id, plugin_context)
def __init__(self, plugin_providers=None)
def unload(self, plugin_instance)
def set_plugin_providers(self, plugin_providers)
def discover(self, discovery_data)