alarm.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 : alarm.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 rospy
18 
19 from python_qt_binding.QtGui import *
20 from python_qt_binding.QtCore import *
21 
22 ## @package: alarm
23 ##
24 ## @version 2.0
25 ## @author Matignon Martin
26 ## @date Last modified 10/03/2014
27 
28 ## @class AlarmDescription
29 ## @brief Class for alarm structure.
30 class AlarmCategory(QObject):
31 
32  INFORMATION = 1
33  WARNNING = 2
34  ERROR = 3
35  CRITICAL = 4
36  FATAL = 5
37  ACQUIT = 6
38 
39  def __init__(self, level = 1, msg='INFO'):
40  QObject.__init__(self)
41  self.level = level
42  self.msg = msg
43 
44 ## @class Alarm
45 ## @brief Class for define alarm structure.
46 class Alarm(QObject):
47 
48  sig_alarm = Signal(AlarmCategory)
49 
50  def __init__(self, parent = None):
51  QObject.__init__(self)
52 
53  if parent is not None:
54  setattr(parent, 'alarm', self)
55 
56  self._actived = False
57 
58  def connect(self, func):
59  self.sig_alarm.connect(func)
60 
61  def emit(self, alarm_category):
62  self.sig_alarm.emit(alarm_category)
63  self._actived = True
64 
65  def acquit(self):
66  if self._actived:
67  self.sig_alarm.emit(AlarmCategory(AlarmCategory.ACQUIT,''))
68  self._actived = False
69 
70 #End of file
Class for define alarm structure.
Definition: alarm.py:46


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