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_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         # no implementation - any method call is relayed as a signal to the service client
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         # no implementation - any method call is relayed as a signal to the service client
00099         pass
00100 
00101     @dbus.service.method('org.ros.qt_gui.PluginHandlerContainer', in_signature='', out_signature='')
00102     def shutdown_plugin_completed(self):
00103         # schedule notification using queued signal, so that dbus does not wait for the call to finish
00104         self._shutdown_plugin_completed.emit()
00105 
00106     @dbus.service.signal('org.ros.qt_gui.PluginHandlerContainer', signature='')
00107     def save_settings(self):
00108         # no implementation - any method call is relayed as a signal to the service client
00109         pass
00110 
00111     @dbus.service.method('org.ros.qt_gui.PluginHandlerContainer', signature='')
00112     def save_settings_completed(self):
00113         # schedule notification using queued signal, so that dbus does not wait for the call to finish
00114         self._save_settings_completed.emit()
00115 
00116     @dbus.service.signal('org.ros.qt_gui.PluginHandlerContainer', signature='')
00117     def restore_settings(self):
00118         # no implementation - any method call is relayed as a signal to the service client
00119         pass
00120 
00121     @dbus.service.method('org.ros.qt_gui.PluginHandlerContainer', in_signature='', out_signature='')
00122     def restore_settings_completed(self):
00123         # schedule notification using queued signal, so that dbus does not wait for the call to finish
00124         self._restore_settings_completed.emit()
00125 
00126     @dbus.service.signal('org.ros.qt_gui.PluginHandlerContainer', signature='')
00127     def trigger_configuration(self):
00128         # no implementation - any method call is relayed as a signal to the service client
00129         pass


qt_gui
Author(s): Dirk Thomas
autogenerated on Fri Jan 3 2014 11:44:00