messagebox.py
Go to the documentation of this file.
00001 #!/usr/bin/env python
00002 #
00003 # Copyright 2015 Airbus
00004 # Copyright 2017 Fraunhofer Institute for Manufacturing Engineering and Automation (IPA)
00005 #
00006 # Licensed under the Apache License, Version 2.0 (the "License");
00007 # you may not use this file except in compliance with the License.
00008 # You may obtain a copy of the License at
00009 #
00010 #   http://www.apache.org/licenses/LICENSE-2.0
00011 #
00012 # Unless required by applicable law or agreed to in writing, software
00013 # distributed under the License is distributed on an "AS IS" BASIS,
00014 # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
00015 # See the License for the specific language governing permissions and
00016 # limitations under the License.
00017 
00018 
00019 import rospy
00020 
00021 from python_qt_binding.QtGui import *
00022 from python_qt_binding.QtCore import *
00023 
00024 from airbus_pyqt_extend.QtAgiCore import loadRsc
00025 
00026 rsc = loadRsc("airbus_pyqt_extend")
00027 
00028 ## @package: message_box
00029 ##
00030 ## @version 1.0
00031 ## @author  Matignon Martin
00032 ## @date    Last modified 22/03/2016
00033 ## @class QPopup
00034 ## @brief Popup object.
00035 ## @class MessageBox
00036 ## @brief Class for redefine QMessageBox.
00037 class QAgiMessageBox(QMessageBox):
00038     
00039     STYLE = "QLabel{font-size: 18pt; font-weight:40; color: #000000;} \
00040              QPushButton{ background-color:qlineargradient(x1: 0, \
00041                                                            y1: 0, \
00042                                                            x2: 0, \
00043                                                            y2: 1, \
00044                                                            stop: 0 #2ca1cf, \
00045                                                            stop: 1 #0482bb); \
00046                           border: 2px #616763; border-radius: 5px; \
00047                           font-size: 16pt; font-weight:40; color: #000000;\
00048                           width:100px; \
00049                           height:40px}"
00050                           
00051     INFO     = QMessageBox.Information
00052     WARN     = QMessageBox.Warning
00053     CRITICAL = QMessageBox.Critical
00054     QUESTION = QMessageBox.Question
00055      
00056     def __init__(self, type=None, msg=None):
00057         """! The constructor."""
00058         
00059         QMessageBox.__init__(self)
00060         self.setWindowFlags(Qt.FramelessWindowHint)
00061         self.setMinimumSize(QSize(600,300))
00062         
00063         style_base = ""
00064         
00065         if type == QMessageBox.Information:
00066             self.setIcon(QMessageBox.Information)
00067             style_base = "QMessageBox{ border: 2px solid bleu;}"
00068         elif type == QMessageBox.Warning:
00069             self.setIcon(QMessageBox.Warning)
00070             style_base = "QMessageBox{ border: 2px solid yellow;}"
00071         elif type == QMessageBox.Critical:
00072             self.setIcon(QMessageBox.Critical)
00073             style_base = "QMessageBox{ border: 2px solid red;}"
00074         elif type == QMessageBox.Question:
00075             self.setIcon(QMessageBox.Question)
00076             style_base = "QMessageBox{ border: 2px solid blue;}"
00077         else:
00078             self.setIcon(QMessageBox.NoIcon)
00079             
00080         self.setStyleSheet(style_base+self.STYLE)
00081         
00082         if msg is not None:
00083             self.setText(msg)
00084             
00085     def setStyle(self, style):
00086         self.STYLE = style
00087         
00088     
00089 #End of file


airbus_pyqt_extend
Author(s): Martin Matignon
autogenerated on Thu Jun 6 2019 17:59:16