widget_installer.py
Go to the documentation of this file.
1 #!/usr/bin/env python
2 ################################################################################
3 #
4 # Copyright Airbus Group SAS 2015
5 # All rigths reserved.
6 #
7 # File Name : widget_installer.py
8 # Authors : Martin Matignon
9 #
10 # If you find any bug or if you have any question please contact
11 # Adolfo Suarez Roos <adolfo.suarez@airbus.com>
12 # Martin Matignon <martin.matignon.external@airbus.com>
13 #
14 #
15 ################################################################################
16 
17 import roslib; roslib.load_manifest('airbus_cobot_gui')
18 import rospy
19 
20 from airbus_cobot_gui.account import Privilege, User
21 
22 ## @package: widget_installer
23 ##
24 ## @version 3.0
25 ## @author Matignon Martin
26 ## @date Last modified 03/03/2014
27 
28 ## @class WidgetInstaller
29 ## @brief Base class for install widget.
31 
32  """
33  Interface for Python widgets which use the ROS client library.
34  User-defined plugins may either subclass `airbus_cobot_gui::Widget` or according to duck typing implement only the needed methods.
35  A widget must not call rospy.init_node() as this is performed once by the framework.
36  The name of the ROS node consists of the prefix "airbus_cobot_gui_py_node_" and the process id.
37  """
38 
39  def __init__(self, user_changed_cb):
40  """! The constructor."""
41  self._label = str(self.__class__.__name__)
42  self._description = 'Not informed !'
43  self._restriction = Privilege.OPERATOR
44  self._user = User(userid='Unknown', privilege=Privilege.NONE)
45  self._user_change_cb = user_changed_cb
46  self._widget = None
47 
48  def install(self, widget_descriptors = {}):
49  """! Install widget configuration.
50  @param widget_descriptors: widget descriptors.
51  @type widget_descriptors: dict{strings}.
52  """
53  self._label = widget_descriptors['label']
54 
55  if widget_descriptors['style-sheet'] is not None:
56  self._widget.setStyleSheet(widget_descriptors['style-sheet'])
57 
58  def set_widget(self, widget):
59  """! Sets content user interface.
60  @param window_ui: user interface object.
61  @type window_ui: QObject.
62  """
63  self._widget = widget
64 
65  def get_widget(self):
66  """! Get widget user interface.
67  @return widget: widget ui.
68  @type widget: QWidget.
69  """
70  return self._widget
71 
72 #End of file
73 


airbus_cobot_gui
Author(s):
autogenerated on Thu Dec 17 2015 11:42:05