def confirmationBox(text,info_text,object_name="confirmationBox"): """ Show a confirmation box to the user. :param text: Summary of the confirmation. :param info_text: Detailed message explaining what to confirm :param object_name: Name for Qt's object. :return: True if the user confirmed. False else. """ box = QMessageBox() box.setObjectName(object_name) box.setWindowTitle(_("Please confirm")) box.setIcon(QMessageBox.Question) _setBoxTexts(box,text,info_text) box.setStandardButtons(QMessageBox.Ok | QMessageBox.Cancel); # box.show() # from PySide.QtTest import QTest # from PySide.QtGui import QApplication # QTest.qWaitForWindowShown(box) # QApplication.instance().removePostedEvents() r = box.exec_() == QMessageBox.Ok box.deleteLater() return r
def confirmationBox(text, info_text, object_name="confirmationBox"): box = QMessageBox() box.setObjectName(object_name) box.setWindowTitle(_("Please confirm")) box.setIcon(QMessageBox.Question) box.setText(text) if info_text: box.setInformativeText(info_text) box.setStandardButtons(QMessageBox.Ok | QMessageBox.Cancel) # box.show() # from PySide.QtTest import QTest # from PySide.QtGui import QApplication # QTest.qWaitForWindowShown(box) # QApplication.instance().removePostedEvents() r = box.exec_() == QMessageBox.Ok box.deleteLater() return r