-
Notifications
You must be signed in to change notification settings - Fork 0
/
dialogModule.py
53 lines (44 loc) · 1.54 KB
/
dialogModule.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
42
43
44
45
46
47
48
49
50
51
52
53
from PyQt4 import QtGui, QtCore
from PyQt4.QtCore import QThread, SIGNAL
import genericDialog
class genDialog(QtGui.QDialog, genericDialog.Ui_Dialog):
def __init__(self, textToDisplay="Not Set", parent=None):
QtGui.QDialog.__init__(self, parent)
self.setupUi(self)
self.labelOutput.setText(textToDisplay)
self.btnConfirm.clicked.connect(self.closeDialog)
self.setProgressValue(0)
def setText(self, newText):
self.labelOutput.setText(newText)
def closeDialog(self):
self.done(0)
def setProgressValue(self, newValue):
"""
assigns 'newValue' to be the
new the progress bar value
"""
try:
self.progressBar.setValue(int(newValue))
if (int(newValue) >= 100):
self.labelOutput.setText("Finished!")
except:
self.progressBar.setValue(0)
def getProgressValue(self):
return self.progressBar.value()
def disableProgressBar(self):
self.progressBar.hide()
def enableOKButton(self):
self.btnConfirm.setEnabled(True)
def disableOKButton(self):
self.btnConfirm.setEnabled(False)
def formatForGenericErrorDisplaying(self):
self.enableOKButton()
self.disableProgressBar()
def formatForGenericActionNotFinished(self):
self.disableOKButton()
self.disableProgressBar()
self.show()
def formatForGenericActionFinished(self):
self.setText("Finished!")
self.enableOKButton()
self.disableProgressBar()