-
Notifications
You must be signed in to change notification settings - Fork 2
/
Copy pathMessage.py
42 lines (32 loc) · 1.29 KB
/
Message.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
from PyQt5.QtCore import * # core Qt functionality
from PyQt5.QtWidgets import *
from PyQt5.QtGui import * # extends QtCore with GUI functionality
from PyQt5 import uic
import sys # We need sys so that we can pass argv to QApplication
import os
import resources # For icons and UIs
class WarningMessage:
def __init__(self):
self._ = 0
def popUpErrorBox(self, message):
''' Input error notification '''
msg = QMessageBox()
msg.setIcon(QMessageBox.Critical)
msg.setText("Error")
msg.setInformativeText(message)
msg.setWindowTitle("Error")
msg.exec_()
def popUpConfirmation(self, title, functionToCall):
''' Ask user to confirm their action -> QMessageBox(), OkButton, CancelButton'''
msg = QMessageBox()
msg.setIcon(QMessageBox.Warning)
msg.setText("Warning")
msg.setInformativeText(title)
msg.setWindowTitle("Warning")
msg.setStandardButtons(QMessageBox.Ok | QMessageBox.Cancel)
OkButton = msg.button(QMessageBox.Ok)
OkButton.clicked.connect(functionToCall)
OkButton.clicked.connect(lambda s: msg.close())
CancelButton = msg.button(QMessageBox.Cancel)
CancelButton.clicked.connect(lambda s: msg.close())
msg.exec_()