Go to the documentation of this file.00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018 import os
00019 import rospy
00020
00021 from python_qt_binding.QtGui import *
00022 from python_qt_binding.QtCore import *
00023
00024 from airbus_pyqt_extend import QtAgiCore
00025
00026
00027 from res import R
00028
00029 class SCXMLState(QStandardItem):
00030
00031 ROOT_STATE = 0
00032 SIMPLE_STATE = 1
00033 PARENT_STATE = 2
00034
00035 NOPE = ""
00036 RECUSIVE = '-r'
00037
00038 PENDING = 0
00039 ACTIVED = 1
00040 ERROR = -1
00041
00042 def __init__(self, name, type=1):
00043 QStandardItem.__init__(self, name)
00044 self.setEditable(False)
00045
00046 self._type = type
00047 self._name = name
00048 self._status = self.PENDING
00049
00050 self.setup()
00051
00052 def setType(self, type):
00053 self._type = type
00054 self.refresh()
00055
00056 def type(self):
00057 return self._type
00058
00059 def setStatus(self, status, opt=""):
00060
00061 self._status = status
00062
00063 if self._type == self.SIMPLE_STATE:
00064
00065 if status == 0:
00066 self.setIcon(R.getIconById("ic_unactive_state"))
00067 elif status == 1:
00068 self.setIcon(R.getIconById("ic_active_state"))
00069 elif status == -1:
00070 self.setIcon(R.getIconById("ic_pause_state"))
00071 else:
00072 self.setIcon(R.getIconById("ic_ssm_in_error"))
00073
00074 elif self._type == self.PARENT_STATE:
00075
00076 if status == 0:
00077 self.setIcon(R.getIconById("ic_unactive_parent_state"))
00078 elif status == 1:
00079 self.setIcon(R.getIconById("ic_active_parent_state"))
00080 elif status == -1:
00081 self.setIcon(R.getIconById("ic_pause_parent_state"))
00082 else:
00083 self.setIcon(R.getIconById("ic_ssm_in_error"))
00084
00085 def status(self):
00086 return self._status
00087
00088 def get_name(self):
00089 return self._name
00090
00091 def refresh(self):
00092 self.setStatus(self.status())
00093
00094 setup = refresh
00095