message_box.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 : message_box.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: message_box
23 ##
24 ## @version 1.0
25 ## @author Matignon Martin
26 ## @date Last modified 10/09/2014
27 ## @class QPopup
28 ## @brief Popup object.
29 ## @class MessageBox
30 ## @brief Class for redefine QMessageBox.
31 class MessageBox(QMessageBox):
32 
33  def __init__(self):
34  """! The constructor."""
35 
36  QMessageBox.__init__(self)
37  self.setWindowFlags(Qt.FramelessWindowHint)
38  self.setMinimumSize(QSize(600,300))
39  self.setStyleSheet("QLabel{ \
40  font-size: 18pt; \
41  font-weight:40; \
42  color: #000000;} \
43  QPushButton{ \
44  background-color:qlineargradient(x1: 0, \
45  y1: 0, \
46  x2: 0, \
47  y2: 1, \
48  stop: 0 #2ca1cf, \
49  stop: 1 #0482bb); \
50  border: 2px #616763; \
51  border-radius: 5px; \
52  font-size: 16pt; \
53  font-weight:40; \
54  color: #000000;}")
55 
56 class MessageBox_v2(QMessageBox):
57 
58  STYLE = "QLabel{font-size: 18pt; font-weight:40; color: #000000;} \
59  QPushButton{ background-color:qlineargradient(x1: 0, \
60  y1: 0, \
61  x2: 0, \
62  y2: 1, \
63  stop: 0 #2ca1cf, \
64  stop: 1 #0482bb); \
65  border: 2px #616763; border-radius: 5px; \
66  font-size: 16pt; font-weight:40; color: #000000;\
67  width:100px; \
68  height:40px}"
69 
70  INFO = QMessageBox.Information
71  WARN = QMessageBox.Warning
72  CRITICAL = QMessageBox.Critical
73  QUESTION = QMessageBox.Question
74 
75  def __init__(self, type=None, msg=None):
76  """! The constructor."""
77 
78  QMessageBox.__init__(self)
79  self.setWindowFlags(Qt.FramelessWindowHint)
80  self.setMinimumSize(QSize(600,300))
81 
82  style_base = ""
83 
84  if type == QMessageBox.Information:
85  self.setIcon(QMessageBox.Information)
86  style_base = "QMessageBox{ border: 2px solid bleu;}"
87  elif type == QMessageBox.Warning:
88  self.setIcon(QMessageBox.Warning)
89  style_base = "QMessageBox{ border: 2px solid yellow;}"
90  elif type == QMessageBox.Critical:
91  self.setIcon(QMessageBox.Critical)
92  style_base = "QMessageBox{ border: 2px solid red;}"
93  elif type == QMessageBox.Question:
94  self.setIcon(QMessageBox.Question)
95  style_base = "QMessageBox{ border: 2px solid blue;}"
96  else:
97  self.setIcon(QMessageBox.NoIcon)
98 
99  self.setStyleSheet(style_base+self.STYLE)
100 
101  if msg is not None:
102  self.setText(msg)
103 
104 
105 #End of file


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