plugin_handler_dbus_service.py
Go to the documentation of this file.
00001 # Copyright (c) 2011, Dirk Thomas, Dorian Scholz, TU Darmstadt
00002 # All rights reserved.
00003 #
00004 # Redistribution and use in source and binary forms, with or without
00005 # modification, are permitted provided that the following conditions
00006 # are met:
00007 #
00008 #   * Redistributions of source code must retain the above copyright
00009 #     notice, this list of conditions and the following disclaimer.
00010 #   * Redistributions in binary form must reproduce the above
00011 #     copyright notice, this list of conditions and the following
00012 #     disclaimer in the documentation and/or other materials provided
00013 #     with the distribution.
00014 #   * Neither the name of the TU Darmstadt nor the names of its
00015 #     contributors may be used to endorse or promote products derived
00016 #     from this software without specific prior written permission.
00017 #
00018 # THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
00019 # "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
00020 # LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
00021 # FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
00022 # COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
00023 # INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
00024 # BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
00025 # LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
00026 # CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
00027 # LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN
00028 # ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
00029 # POSSIBILITY OF SUCH DAMAGE.
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         # no implementation - any method call is relayed as a signal to the service client
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         # no implementation - any method call is relayed as a signal to the service client
00103         pass
00104 
00105     @dbus.service.method('org.ros.qt_gui.PluginHandlerContainer', in_signature='', out_signature='')
00106     def shutdown_plugin_completed(self):
00107         # schedule notification using queued signal, so that dbus does not wait for the call to finish
00108         self._shutdown_plugin_completed.emit()
00109 
00110     @dbus.service.signal('org.ros.qt_gui.PluginHandlerContainer', signature='')
00111     def save_settings(self):
00112         # no implementation - any method call is relayed as a signal to the service client
00113         pass
00114 
00115     @dbus.service.method('org.ros.qt_gui.PluginHandlerContainer', signature='')
00116     def save_settings_completed(self):
00117         # schedule notification using queued signal, so that dbus does not wait for the call to finish
00118         self._save_settings_completed.emit()
00119 
00120     @dbus.service.signal('org.ros.qt_gui.PluginHandlerContainer', signature='')
00121     def restore_settings(self):
00122         # no implementation - any method call is relayed as a signal to the service client
00123         pass
00124 
00125     @dbus.service.method('org.ros.qt_gui.PluginHandlerContainer', in_signature='', out_signature='')
00126     def restore_settings_completed(self):
00127         # schedule notification using queued signal, so that dbus does not wait for the call to finish
00128         self._restore_settings_completed.emit()
00129 
00130     @dbus.service.signal('org.ros.qt_gui.PluginHandlerContainer', signature='')
00131     def trigger_configuration(self):
00132         # no implementation - any method call is relayed as a signal to the service client
00133         pass


qt_gui
Author(s): Dirk Thomas
autogenerated on Thu Jun 6 2019 18:07:34