-
Notifications
You must be signed in to change notification settings - Fork 0
/
testWaitProgress.py
55 lines (43 loc) · 1.45 KB
/
testWaitProgress.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
from MyWaitProgressDialog import *
import sys
def setWindowCenter(window):
'''setWindowCenter(QWidget)'''
cp = window.frameGeometry()
lo = QDesktopWidget().availableGeometry().center()
cp.moveCenter(lo)
window.move(cp.topLeft())
class MainWindow(QMainWindow):
def __init__(self):
super(MainWindow, self).__init__()
self.initUI()
def initUI(self):
backGround = QWidget(self)
button = QPushButton('begin wait')
button.clicked.connect(self.showProgress)
vbox = QVBoxLayout()
vbox.addStretch(1)
vbox.addWidget(button)
hbox = QHBoxLayout()
hbox.addStretch(1)
hbox.addLayout(vbox)
backGround.setLayout(hbox)
self.setGeometry(100,100,500,500)
self.setCentralWidget(backGround)
self.setWindowTitle('testWaitProgress')
setWindowCenter(self)
self.show()
def showProgress(self, isTrue):
print('showProgress:{}'.format(isTrue))
self.timer = QTimer()
self.timer.timeout.connect(self.timesUp)
self.timer.start(30*1000)
self.progress = MyWaitProgressDialog('begin...',self)
self.progress.RotateStyle = MyRotateProgress.MyRotateProgress.PenStyleNormal
self.progress.exec()
def timesUp(self):
self.progress.close()
self.timer.stop()
if __name__ == "__main__":
app = QApplication(sys.argv)
window = MainWindow()
sys.exit(app.exec_())