-
Notifications
You must be signed in to change notification settings - Fork 0
/
rigid_skin_dialog.py
64 lines (54 loc) · 2.14 KB
/
rigid_skin_dialog.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
54
55
56
57
58
59
60
61
62
63
64
from PySide import QtGui, QtCore
import rigid_skin_utils as RSU
class ProcessDialog(QtGui.QDialog):
def __init__(self, parent=None, fixedHeight=-1, enableButton=False):
QtGui.QDialog.__init__(self)
if fixedHeight != -1:
self.setFixedHeight(fixedHeight)
self.enableButtonFlag = enableButton
self.resize(450, 350)
self.setModal(True)
self.setWindowTitle('Processing....')
self.setObjectName('PROCESS_DIALOG')
self.activityLog = QtGui.QListWidget()
self.btnOK = QtGui.QPushButton('OK')
self.btnOK.setDisabled(True)
self.btnCancel = QtGui.QPushButton('Cancel')
self.layout = QtGui.QVBoxLayout()
self.layout.setSpacing(0)
self.layout.addWidget(self.activityLog, 0)
self.layout.setContentsMargins(0,0,0,0)
self.setLayout(self.layout)
self.btnOK.clicked.connect(self.close)
#self.btnCancel.clicked.connect(self.cancelExport)
def closeEvent(self, event):
""" On close we are removing the Qt window from memory """
self.deleteLater()
event.accept()
def cancelExport(self):
self.updateLog(process='Cancelled Export. Undoing process...', error=True)
#self.enableButton()
self.btnCancel.setDisabled(True)
self.activateWindow()
def updateLog(self, process, success=False, warning=False, error=False, textColor=None):
import datetime
time = datetime.time(datetime.datetime.now().hour, datetime.datetime.now().minute, datetime.datetime.now().second)
time = str(time)
processWidget = QtGui.QListWidgetItem(time + ': ' +process)
processWidget.setFlags(QtCore.Qt.ItemIsEnabled)
'''
if warning == True:
#processWidget.setTextColor(QtGui.QColor('orange'))
RSU.setWidgetBackground(item=processWidget, color='orange')
if error == True:
#processWidget.setTextColor(QtGui.QColor('red'))
RSU.setWidgetBackground(item=processWidget, color='red')
if success == True:
#processWidget.setBackgroundColor(QtGui.QColor('green'))
RSU.setWidgetBackground(item=processWidget, color='green')
'''
self.activityLog.addItem(processWidget)
self.activityLog.scrollToItem(processWidget)
QtGui.qApp.processEvents()
def clearLog(self):
self.activityLog.clear()