20 from roslib.packages
import get_pkg_dir
21 from python_qt_binding
import QtGui
22 from python_qt_binding
import QtCore
40 """! The constructor."""
41 self.
_label = str(self.__class__.__name__)
44 self.
_user = User(userid=
'Unknown', privilege=Privilege.NONE)
50 self._launcher.setFocusPolicy(QtCore.Qt.NoFocus)
51 self._launcher.setObjectName(str(uuid.uuid1()))
55 def install(self, plugin_descriptors = {}):
56 """! Install Plugin with plugin description.
57 @param plugin_descriptors: plugin descriptors.
58 @type plugin_descriptors: dict(strings).
61 self.
_label = plugin_descriptors[
'label']
63 self.
_restriction = Privilege.TOLEVEL[plugin_descriptors[
'restriction']]
65 if plugin_descriptors[
'style-sheet']
is not None:
66 self._widget.setStyleSheet(plugin_descriptors[
'style-sheet'])
71 """! Setup launcher button.
72 @param icon_path: icon path.
73 @type icon_path: String.
75 self._launcher.setSizePolicy(QtGui.QSizePolicy.Expanding,
76 QtGui.QSizePolicy.Preferred)
78 if os.access(icon_path, os.W_OK):
79 self._launcher.setIcon(QtGui.QIcon(icon_path))
81 self._launcher.setStyleSheet(
"background-color: rgba(255,0,0,80%);\
86 self._launcher.setText(self.
_label)
88 self._launcher.setEnabled(
False)
91 """! Get launcher button.
92 @return launcher: plugin launcher button.
93 @type launcher: QPushButton.
98 """! Methode called when user account changed.
99 @param user: user informations.
106 self._launcher.setEnabled(
False)
108 self._launcher.setEnabled(
True)
112 except Exception
as e:
113 rospy.logerr(
'%s::user_changed_event(%s) raised with exception "%s"'
118 self._widget.setObjectName(self._launcher.objectName())
137 if name
in self._parameters.keys():
140 rospy.logerr(
'Plugin::%s parameter "%s" not found !'
def install
Install Plugin with plugin description.
def __init__
The constructor.
def _setup_launcher
Setup launcher button.
Base class for install plugin components.
def _update_user
Methode called when user account changed.
def _get_launcher
Get launcher button.