E5Gui/E5MessageBox.py

changeset 588
573767cf6bde
parent 564
b3d966393ba9
child 591
c92803caf37f
equal deleted inserted replaced
587:3078a9781573 588:573767cf6bde
76 @keyparam buttons set of standard buttons to generate (StandardButtons) 76 @keyparam buttons set of standard buttons to generate (StandardButtons)
77 @keyparam parent parent widget of the message box (QWidget) 77 @keyparam parent parent widget of the message box (QWidget)
78 """ 78 """
79 QMessageBox.__init__(self, parent) 79 QMessageBox.__init__(self, parent)
80 self.setIcon(icon) 80 self.setIcon(icon)
81 if modal and parent is not None: 81 if modal:
82 self.setWindowModality(Qt.WindowModal) 82 if parent is not None:
83 self.setWindowModality(Qt.WindowModal)
84 else:
85 self.setWindowModality(Qt.ApplicationModal)
86 else:
87 self.setWindowModality(Qt.NonModal)
83 if title == "": 88 if title == "":
84 self.setWindowTitle("{0}".format( 89 self.setWindowTitle("{0}".format(
85 QApplication.applicationName())) 90 QApplication.applicationName()))
86 else: 91 else:
87 self.setWindowTitle("{0} - {1}".format( 92 self.setWindowTitle("{0} - {1}".format(
88 QApplication.applicationName(), title)) 93 QApplication.applicationName(), title))
89 self.setText(text) 94 self.setText(text)
95 if buttons == QMessageBox.NoButton:
96 buttons = QMessageBox.StandardButtons(QMessageBox.Ok)
90 self.setStandardButtons(buttons) 97 self.setStandardButtons(buttons)
91 98
92 ################################################################################ 99 ################################################################################
93 ## Replacements for QMessageBox static methods ## 100 ## Replacements for QMessageBox static methods ##
94 ################################################################################ 101 ################################################################################

eric ide

mercurial