32 from python_qt_binding.QtCore
import QSize
39 Dashboard widget to display motor state and allow interaction.
41 def __init__(self, reset_callback, halt_callback):
43 :param context: the plugin context
44 :type context: qt_gui.plugin.Plugin
45 :param reset_callback: calback for the "reset" action
46 :type reset_callback: function
47 :param halt_callback: calback for the "reset" action
48 :type halt_callback: function
50 ok_icon = [
'bg-green.svg',
'ic-motors.svg']
51 warn_icon = [
'bg-yellow.svg',
'ic-motors.svg',
'ol-warn-badge.svg']
52 err_icon = [
'bg-red.svg',
'ic-motors.svg',
'ol-err-badge.svg']
53 stale_icon = [
'bg-grey.svg',
'ic-motors.svg',
'ol-stale-badge.svg']
55 icons = [ok_icon, warn_icon, err_icon, stale_icon]
56 super(PR2Motors, self).
__init__(
'Motors', icons)
59 self.add_action(
'Reset', reset_callback)
60 self.add_action(
'Halt', halt_callback)
61 self.setToolTip(
'Motors')
63 self.setFixedSize(self._icons[0].actualSize(QSize(50, 30)))