Source code for gwa.code.popups

#!/usr/bin/python
# -*- coding: utf-8 -*-

from PyQt4 import QtGui, QtCore


[docs]class Popups: def __init__(self): self.title_popup=None self.text_popup=None
[docs] def popupOK(self, title_popup, text_popup): """ The 'popupOK' displays a popup with the information 'OK' button. :arguments: - title_popup (type string) Text of the title bar of the window - text_popup (type string) Text of the popup (can include carriage returns to put multiple lines) :return: Reference button that was clicked. """ return QtGui.QMessageBox.information(QtGui.QWizard(), title_popup, text_popup, QtGui.QMessageBox.Ok, QtGui.QMessageBox.Ok)
[docs] def popupYesNo(self, title_popup, text_popup): """ The 'popupYesNo' displays a popup with the information button 'Yes' and 'No'. :arguments: - title_popup (type string) Text of the title bar of the window - text_popup (type string) Text of the popup (can include carriage returns to put multiple lines) :return: Reference button that was clicked. """ result = QtGui.QMessageBox.information(QtGui.QWizard(), title_popup, text_popup, QtGui.QMessageBox.Yes, QtGui.QMessageBox.No) if result == QtGui.QMessageBox.Yes: return True else: return False