00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020
00021
00022
00023
00024
00025
00026
00027
00028
00029
00030
00031 from dbus.service import Object
00032 import dbus
00033
00034 from python_qt_binding.QtCore import QObject, Qt, Signal
00035
00036
00037 class PluginHandlerDBusService(Object):
00038
00039 """DBus service for an indirect plugin handler, i.e. `PluginHandlerXEmbedContainer`."""
00040
00041 class QueuedSignal(QObject):
00042
00043 _signal = Signal()
00044
00045 def __init__(self, callback):
00046 super(PluginHandlerDBusService.QueuedSignal, self).__init__()
00047 self._signal.connect(callback, Qt.QueuedConnection)
00048
00049 def emit(self):
00050 self._signal.emit()
00051
00052 def __init__(self, plugin_handler, object_path):
00053 super(PluginHandlerDBusService, self).__init__(object_path)
00054 self._plugin_handler = plugin_handler
00055 self._save_settings_completed = PluginHandlerDBusService.QueuedSignal(self._plugin_handler.emit_save_settings_completed)
00056 self._restore_settings_completed = PluginHandlerDBusService.QueuedSignal(self._plugin_handler.emit_restore_settings_completed)
00057 self._shutdown_plugin_completed = PluginHandlerDBusService.QueuedSignal(self._plugin_handler.emit_shutdown_plugin_completed)
00058
00059 @dbus.service.method('org.ros.qt_gui.PluginHandlerContainer', in_signature='bb', out_signature='')
00060 def load_completed(self, loaded, has_configuration):
00061 self._plugin_handler.load_completed(loaded, has_configuration)
00062
00063 @dbus.service.method('org.ros.qt_gui.PluginHandlerContainer', in_signature='is', out_signature='i')
00064 def embed_widget(self, pid, widget_object_name):
00065 return self._plugin_handler.embed_widget(pid, widget_object_name)
00066
00067 @dbus.service.method('org.ros.qt_gui.PluginHandlerContainer', in_signature='ss', out_signature='')
00068 def update_embedded_widget_title(self, widget_object_name, title):
00069 self._plugin_handler.update_embedded_widget_title(widget_object_name, title)
00070
00071 @dbus.service.method('org.ros.qt_gui.PluginHandlerContainer', in_signature='s', out_signature='')
00072 def unembed_widget(self, widget_object_name):
00073 self._plugin_handler.unembed_widget(widget_object_name)
00074
00075 @dbus.service.method('org.ros.qt_gui.PluginHandlerContainer', in_signature='is', out_signature='i')
00076 def embed_toolbar(self, pid, toolbar_object_name):
00077 return self._plugin_handler.embed_toolbar(pid, toolbar_object_name)
00078
00079 @dbus.service.signal('org.ros.qt_gui.PluginHandlerContainer', signature='ib')
00080 def toolbar_orientation_changed(self, win_id, is_horizontal):
00081
00082 pass
00083
00084 @dbus.service.method('org.ros.qt_gui.PluginHandlerContainer', in_signature='s', out_signature='')
00085 def unembed_toolbar(self, toolbar_object_name):
00086 self._plugin_handler.unembed_toolbar(toolbar_object_name)
00087
00088 @dbus.service.method('org.ros.qt_gui.PluginHandlerContainer', in_signature='', out_signature='')
00089 def close_plugin(self):
00090 self._plugin_handler._emit_close_plugin()
00091
00092 @dbus.service.method('org.ros.qt_gui.PluginHandlerContainer', in_signature='', out_signature='')
00093 def reload_plugin(self):
00094 self._plugin_handler._emit_reload_signal()
00095
00096 @dbus.service.signal('org.ros.qt_gui.PluginHandlerContainer', signature='')
00097 def shutdown_plugin(self):
00098
00099 pass
00100
00101 @dbus.service.method('org.ros.qt_gui.PluginHandlerContainer', in_signature='', out_signature='')
00102 def shutdown_plugin_completed(self):
00103
00104 self._shutdown_plugin_completed.emit()
00105
00106 @dbus.service.signal('org.ros.qt_gui.PluginHandlerContainer', signature='')
00107 def save_settings(self):
00108
00109 pass
00110
00111 @dbus.service.method('org.ros.qt_gui.PluginHandlerContainer', signature='')
00112 def save_settings_completed(self):
00113
00114 self._save_settings_completed.emit()
00115
00116 @dbus.service.signal('org.ros.qt_gui.PluginHandlerContainer', signature='')
00117 def restore_settings(self):
00118
00119 pass
00120
00121 @dbus.service.method('org.ros.qt_gui.PluginHandlerContainer', in_signature='', out_signature='')
00122 def restore_settings_completed(self):
00123
00124 self._restore_settings_completed.emit()
00125
00126 @dbus.service.signal('org.ros.qt_gui.PluginHandlerContainer', signature='')
00127 def trigger_configuration(self):
00128
00129 pass