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_icon(self, widget_object_name, icon):
00069 self._plugin_handler.update_embedded_widget_icon(widget_object_name, icon)
00070
00071 @dbus.service.method('org.ros.qt_gui.PluginHandlerContainer', in_signature='ss', out_signature='')
00072 def update_embedded_widget_title(self, widget_object_name, title):
00073 self._plugin_handler.update_embedded_widget_title(widget_object_name, title)
00074
00075 @dbus.service.method('org.ros.qt_gui.PluginHandlerContainer', in_signature='s', out_signature='')
00076 def unembed_widget(self, widget_object_name):
00077 self._plugin_handler.unembed_widget(widget_object_name)
00078
00079 @dbus.service.method('org.ros.qt_gui.PluginHandlerContainer', in_signature='is', out_signature='i')
00080 def embed_toolbar(self, pid, toolbar_object_name):
00081 return self._plugin_handler.embed_toolbar(pid, toolbar_object_name)
00082
00083 @dbus.service.signal('org.ros.qt_gui.PluginHandlerContainer', signature='ib')
00084 def toolbar_orientation_changed(self, win_id, is_horizontal):
00085
00086 pass
00087
00088 @dbus.service.method('org.ros.qt_gui.PluginHandlerContainer', in_signature='s', out_signature='')
00089 def unembed_toolbar(self, toolbar_object_name):
00090 self._plugin_handler.unembed_toolbar(toolbar_object_name)
00091
00092 @dbus.service.method('org.ros.qt_gui.PluginHandlerContainer', in_signature='', out_signature='')
00093 def close_plugin(self):
00094 self._plugin_handler._emit_close_plugin()
00095
00096 @dbus.service.method('org.ros.qt_gui.PluginHandlerContainer', in_signature='', out_signature='')
00097 def reload_plugin(self):
00098 self._plugin_handler._emit_reload_signal()
00099
00100 @dbus.service.signal('org.ros.qt_gui.PluginHandlerContainer', signature='')
00101 def shutdown_plugin(self):
00102
00103 pass
00104
00105 @dbus.service.method('org.ros.qt_gui.PluginHandlerContainer', in_signature='', out_signature='')
00106 def shutdown_plugin_completed(self):
00107
00108 self._shutdown_plugin_completed.emit()
00109
00110 @dbus.service.signal('org.ros.qt_gui.PluginHandlerContainer', signature='')
00111 def save_settings(self):
00112
00113 pass
00114
00115 @dbus.service.method('org.ros.qt_gui.PluginHandlerContainer', signature='')
00116 def save_settings_completed(self):
00117
00118 self._save_settings_completed.emit()
00119
00120 @dbus.service.signal('org.ros.qt_gui.PluginHandlerContainer', signature='')
00121 def restore_settings(self):
00122
00123 pass
00124
00125 @dbus.service.method('org.ros.qt_gui.PluginHandlerContainer', in_signature='', out_signature='')
00126 def restore_settings_completed(self):
00127
00128 self._restore_settings_completed.emit()
00129
00130 @dbus.service.signal('org.ros.qt_gui.PluginHandlerContainer', signature='')
00131 def trigger_configuration(self):
00132
00133 pass