-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathvalidator.py
91 lines (61 loc) · 2.33 KB
/
validator.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
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
from PyQt4 import QtGui
def createIntroPage():
page = QtGui.QWizardPage()
page.setTitle("Introduction")
label = QtGui.QLabel("This wizard will help you register your copy of "
"Super Product Two.")
label.setWordWrap(True)
layout = QtGui.QVBoxLayout()
layout.addWidget(label)
page.setLayout(layout)
return page
def createRegistrationPage():
page = QtGui.QWizardPage()
page.setTitle("Registration")
page.setSubTitle("Please fill both fields.")
nameLabel = QtGui.QLabel("Name:")
nameLineEdit = QtGui.QLineEdit()
emailLabel = QtGui.QLabel("Email address:")
emailLineEdit = QtGui.QLineEdit()
layout = QtGui.QGridLayout()
layout.addWidget(nameLabel, 0, 0)
layout.addWidget(nameLineEdit, 0, 1)
layout.addWidget(emailLabel, 1, 0)
layout.addWidget(emailLineEdit, 1, 1)
page.setLayout(layout)
return page
def createConclusionPage():
page = QtGui.QWizardPage()
page.setTitle("Conclusion")
label = QtGui.QLabel("You are now successfully registered. Have a nice day!")
label.setWordWrap(True)
layout = QtGui.QVBoxLayout()
layout.addWidget(label)
page.setLayout(layout)
return page
def backprint():
print("Action: back Page: " + wizard.currentPage().title())
def nextprint():
print("Action: next Page: " + wizard.currentPage().title())
def commitprint():
print("Action: commit Page: " + wizard.currentPage().title())
def finishprint():
print("Action:finish Page: " + wizard.currentPage().title())
def cancelprint():
print("Action:cancel Page: " + wizard.currentPage().title())
if __name__ == '__main__':
import sys
app = QtGui.QApplication(sys.argv)
wizard = QtGui.QWizard()
wizard.addPage(createIntroPage())
wizard.addPage(createRegistrationPage())
wizard.addPage(createConclusionPage())
wizard.button(QtGui.QWizard.BackButton).clicked.connect(backprint)
wizard.button(QtGui.QWizard.NextButton).clicked.connect(nextprint)
wizard.button(QtGui.QWizard.CommitButton).clicked.connect(commitprint)
wizard.button(QtGui.QWizard.FinishButton).clicked.connect(finishprint)
wizard.button(QtGui.QWizard.CancelButton).clicked.connect(cancelprint)
wizard.setWindowTitle("Trivial Wizard")
wizard.show()
print("Page :" + wizard.currentPage().title())
sys.exit(wizard.exec_())