33 from python_qt_binding.QtCore
import qCritical, QEvent, QObject, qWarning, Slot
40 """Handler for directly passing invocations between the framework and one `Plugin` instance."""
42 def __init__(self, parent, main_window, instance_id,
43 application_context, container_manager, argv):
44 super(PluginHandlerDirect, self).
__init__(
45 parent, main_window, instance_id, application_context, container_manager, argv)
46 self.setObjectName(
'PluginHandlerDirect')
50 def load(self, plugin_provider, callback=None):
52 super(PluginHandlerDirect, self).
load(plugin_provider, callback)
56 if hasattr(self.
_plugin,
'has_configuration'):
64 if exception
is None and hasattr(self.
_plugin,
'installEventFilter'):
66 self.
_plugin.installEventFilter(self)
70 if event.type() == QEvent.DeferredDelete:
75 return QObject.eventFilter(self, watched, event)
78 if hasattr(self.
_plugin,
'removeEventFilter'):
79 self.
_plugin.removeEventFilter(self)
81 if hasattr(self.
_plugin,
'deleteLater'):
85 if hasattr(self.
_plugin,
'shutdown_plugin'):
90 'PluginHandlerDirect._shutdown_plugin() plugin "%s" raised an '
91 'exception:\n%s' % (str(self.
_instance_id), traceback.format_exc()))
105 if hasattr(self.
_plugin,
'save_settings'):
106 plugin_settings_plugin = plugin_settings.get_settings(
'plugin')
107 instance_settings_plugin = instance_settings.get_settings(
'plugin')
112 'PluginHandlerDirect._save_settings() plugin "%s" raised an exception:\n%s' %
117 if hasattr(self.
_plugin,
'restore_settings'):
118 plugin_settings_plugin = plugin_settings.get_settings(
'plugin')
119 instance_settings_plugin = instance_settings.get_settings(
'plugin')
124 'PluginHandlerDirect._restore_settings() plugin "%s" raised an exception:\n%s' %
132 qWarning(
'PluginHandlerDirect.add_widget() widget "%s" already added' %
142 qWarning(
'PluginHandlerDirect.add_toolbar() toolbar "%s" already added' %
143 toolbar.objectName())