plugin_handler_dbus_service.py
Go to the documentation of this file.
1 # Copyright (c) 2011, Dirk Thomas, Dorian Scholz, TU Darmstadt
2 # All rights reserved.
3 #
4 # Redistribution and use in source and binary forms, with or without
5 # modification, are permitted provided that the following conditions
6 # are met:
7 #
8 # * Redistributions of source code must retain the above copyright
9 # notice, this list of conditions and the following disclaimer.
10 # * Redistributions in binary form must reproduce the above
11 # copyright notice, this list of conditions and the following
12 # disclaimer in the documentation and/or other materials provided
13 # with the distribution.
14 # * Neither the name of the TU Darmstadt nor the names of its
15 # contributors may be used to endorse or promote products derived
16 # from this software without specific prior written permission.
17 #
18 # THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
19 # "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
20 # LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
21 # FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
22 # COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
23 # INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
24 # BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
25 # LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
26 # CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
27 # LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN
28 # ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
29 # POSSIBILITY OF SUCH DAMAGE.
30 
31 import dbus
32 from dbus.service import Object
33 
34 from python_qt_binding.QtCore import QObject, Qt, Signal
35 
36 
38  """DBus service for an indirect plugin handler, i.e. `PluginHandlerXEmbedContainer`."""
39 
40  class QueuedSignal(QObject):
41 
42  _signal = Signal()
43 
44  def __init__(self, callback):
46  self._signal.connect(callback, Qt.QueuedConnection)
47 
48  def emit(self):
49  self._signal.emit()
50 
51  def __init__(self, plugin_handler, object_path):
52  super(PluginHandlerDBusService, self).__init__(object_path)
53  self._plugin_handler = plugin_handler
55  self._plugin_handler.emit_save_settings_completed)
57  self._plugin_handler.emit_restore_settings_completed)
59  self._plugin_handler.emit_shutdown_plugin_completed)
60 
61  @dbus.service.method(
62  'org.ros.qt_gui.PluginHandlerContainer', in_signature='bb', out_signature='')
63  def load_completed(self, loaded, has_configuration):
64  self._plugin_handler.load_completed(loaded, has_configuration)
65 
66  @dbus.service.method(
67  'org.ros.qt_gui.PluginHandlerContainer', in_signature='is', out_signature='i')
68  def embed_widget(self, pid, widget_object_name):
69  return self._plugin_handler.embed_widget(pid, widget_object_name)
70 
71  @dbus.service.method(
72  'org.ros.qt_gui.PluginHandlerContainer', in_signature='ss', out_signature='')
73  def update_embedded_widget_icon(self, widget_object_name, icon):
74  self._plugin_handler.update_embedded_widget_icon(widget_object_name, icon)
75 
76  @dbus.service.method(
77  'org.ros.qt_gui.PluginHandlerContainer', in_signature='ss', out_signature='')
78  def update_embedded_widget_title(self, widget_object_name, title):
79  self._plugin_handler.update_embedded_widget_title(widget_object_name, title)
80 
81  @dbus.service.method(
82  'org.ros.qt_gui.PluginHandlerContainer', in_signature='s', out_signature='')
83  def unembed_widget(self, widget_object_name):
84  self._plugin_handler.unembed_widget(widget_object_name)
85 
86  @dbus.service.method(
87  'org.ros.qt_gui.PluginHandlerContainer', in_signature='is', out_signature='i')
88  def embed_toolbar(self, pid, toolbar_object_name):
89  return self._plugin_handler.embed_toolbar(pid, toolbar_object_name)
90 
91  @dbus.service.signal('org.ros.qt_gui.PluginHandlerContainer', signature='ib')
92  def toolbar_orientation_changed(self, win_id, is_horizontal):
93  # no implementation - any method call is relayed as a signal to the service client
94  pass
95 
96  @dbus.service.method(
97  'org.ros.qt_gui.PluginHandlerContainer', in_signature='s', out_signature='')
98  def unembed_toolbar(self, toolbar_object_name):
99  self._plugin_handler.unembed_toolbar(toolbar_object_name)
100 
101  @dbus.service.method('org.ros.qt_gui.PluginHandlerContainer', in_signature='',
102  out_signature='')
103  def close_plugin(self):
104  self._plugin_handler._emit_close_plugin()
105 
106  @dbus.service.method('org.ros.qt_gui.PluginHandlerContainer', in_signature='',
107  out_signature='')
108  def reload_plugin(self):
109  self._plugin_handler._emit_reload_signal()
110 
111  @dbus.service.signal('org.ros.qt_gui.PluginHandlerContainer', signature='')
112  def shutdown_plugin(self):
113  # no implementation - any method call is relayed as a signal to the service client
114  pass
115 
116  @dbus.service.method('org.ros.qt_gui.PluginHandlerContainer', in_signature='',
117  out_signature='')
119  # schedule notification using queued signal, so that dbus does not wait
120  # for the call to finish
121  self._shutdown_plugin_completed.emit()
122 
123  @dbus.service.signal('org.ros.qt_gui.PluginHandlerContainer', signature='')
124  def save_settings(self):
125  # no implementation - any method call is relayed as a signal to the service client
126  pass
127 
128  @dbus.service.method('org.ros.qt_gui.PluginHandlerContainer', signature='')
130  # schedule notification using queued signal, so that dbus does not wait
131  # for the call to finish
132  self._save_settings_completed.emit()
133 
134  @dbus.service.signal('org.ros.qt_gui.PluginHandlerContainer', signature='')
135  def restore_settings(self):
136  # no implementation - any method call is relayed as a signal to the service client
137  pass
138 
139  @dbus.service.method('org.ros.qt_gui.PluginHandlerContainer', in_signature='',
140  out_signature='')
142  # schedule notification using queued signal, so that dbus does not wait
143  # for the call to finish
144  self._restore_settings_completed.emit()
145 
146  @dbus.service.signal('org.ros.qt_gui.PluginHandlerContainer', signature='')
148  # no implementation - any method call is relayed as a signal to the service client
149  pass
qt_gui.plugin_handler_dbus_service.PluginHandlerDBusService._save_settings_completed
_save_settings_completed
Definition: plugin_handler_dbus_service.py:54
qt_gui.plugin_handler_dbus_service.PluginHandlerDBusService.unembed_toolbar
def unembed_toolbar(self, toolbar_object_name)
Definition: plugin_handler_dbus_service.py:98
qt_gui.plugin_handler_dbus_service.PluginHandlerDBusService.save_settings_completed
def save_settings_completed(self)
Definition: plugin_handler_dbus_service.py:129
qt_gui.plugin_handler_dbus_service.PluginHandlerDBusService.shutdown_plugin_completed
def shutdown_plugin_completed(self)
Definition: plugin_handler_dbus_service.py:118
qt_gui.plugin_handler_dbus_service.PluginHandlerDBusService.unembed_widget
def unembed_widget(self, widget_object_name)
Definition: plugin_handler_dbus_service.py:83
qt_gui.plugin_handler_dbus_service.PluginHandlerDBusService.QueuedSignal
Definition: plugin_handler_dbus_service.py:40
qt_gui.plugin_handler_dbus_service.PluginHandlerDBusService.close_plugin
def close_plugin(self)
Definition: plugin_handler_dbus_service.py:103
qt_gui.plugin_handler_dbus_service.PluginHandlerDBusService.save_settings
def save_settings(self)
Definition: plugin_handler_dbus_service.py:124
qt_gui.plugin_handler_dbus_service.PluginHandlerDBusService
Definition: plugin_handler_dbus_service.py:37
qt_gui.plugin_handler_dbus_service.PluginHandlerDBusService.__init__
def __init__(self, plugin_handler, object_path)
Definition: plugin_handler_dbus_service.py:51
qt_gui.plugin_handler_dbus_service.PluginHandlerDBusService._plugin_handler
_plugin_handler
Definition: plugin_handler_dbus_service.py:53
qt_gui.plugin_handler_dbus_service.PluginHandlerDBusService.update_embedded_widget_title
def update_embedded_widget_title(self, widget_object_name, title)
Definition: plugin_handler_dbus_service.py:78
qt_gui.plugin_handler_dbus_service.PluginHandlerDBusService.embed_toolbar
def embed_toolbar(self, pid, toolbar_object_name)
Definition: plugin_handler_dbus_service.py:88
qt_gui.plugin_handler_dbus_service.PluginHandlerDBusService.embed_widget
def embed_widget(self, pid, widget_object_name)
Definition: plugin_handler_dbus_service.py:68
qt_gui.plugin_handler_dbus_service.PluginHandlerDBusService.QueuedSignal.emit
def emit(self)
Definition: plugin_handler_dbus_service.py:48
qt_gui.plugin_handler_dbus_service.PluginHandlerDBusService.shutdown_plugin
def shutdown_plugin(self)
Definition: plugin_handler_dbus_service.py:112
qt_gui.plugin_handler_dbus_service.PluginHandlerDBusService.QueuedSignal.__init__
def __init__(self, callback)
Definition: plugin_handler_dbus_service.py:44
qt_gui.plugin_handler_dbus_service.PluginHandlerDBusService.reload_plugin
def reload_plugin(self)
Definition: plugin_handler_dbus_service.py:108
qt_gui.plugin_handler_dbus_service.PluginHandlerDBusService.trigger_configuration
def trigger_configuration(self)
Definition: plugin_handler_dbus_service.py:147
qt_gui.plugin_handler_dbus_service.PluginHandlerDBusService.load_completed
def load_completed(self, loaded, has_configuration)
Definition: plugin_handler_dbus_service.py:63
qt_gui.plugin_handler_dbus_service.PluginHandlerDBusService.restore_settings_completed
def restore_settings_completed(self)
Definition: plugin_handler_dbus_service.py:141
qt_gui.plugin_handler_dbus_service.PluginHandlerDBusService.restore_settings
def restore_settings(self)
Definition: plugin_handler_dbus_service.py:135
qt_gui.plugin_handler_dbus_service.PluginHandlerDBusService.QueuedSignal._signal
_signal
Definition: plugin_handler_dbus_service.py:42
qt_gui.plugin_handler_dbus_service.PluginHandlerDBusService._restore_settings_completed
_restore_settings_completed
Definition: plugin_handler_dbus_service.py:56
qt_gui.plugin_handler_dbus_service.PluginHandlerDBusService.toolbar_orientation_changed
def toolbar_orientation_changed(self, win_id, is_horizontal)
Definition: plugin_handler_dbus_service.py:92
qt_gui.plugin_handler_dbus_service.PluginHandlerDBusService.update_embedded_widget_icon
def update_embedded_widget_icon(self, widget_object_name, icon)
Definition: plugin_handler_dbus_service.py:73
qt_gui.plugin_handler_dbus_service.PluginHandlerDBusService._shutdown_plugin_completed
_shutdown_plugin_completed
Definition: plugin_handler_dbus_service.py:58


qt_gui
Author(s): Dirk Thomas
autogenerated on Sat Jun 25 2022 02:15:05