def __init__(self, taskName):
"""Constructor for QProgressTaskDialog
Arguments:
string taskName -- Title of the window and label before progress bar
Example:
W = QProgressTaskDialog("Clearing Forest")
for i in range(100):
if not W.isCancelled():
W.setProgress(i + 1)
else:
W.close()
"""
super().__init__()
self.setGeometry(800, 400, 600, 70)
self.setWindowTitle(taskName)
self.__taskLabel = QtWidgets.QLabel(self)
self.__taskLabel.setText(taskName)
self.__subTaskLabel = QtWidgets.QLabel(self)
self.__subTaskLabel.setText("Working...")
self.__progressBar = QtWidgets.QProgressBar(self)
self.__cancelButton = QtWidgets.QPushButton(self)
self.__cancelButton.clicked.connect(self.__cancelTask)
self.__cancelButton.setText("Cancel")
__hLayout = QtWidgets.QHBoxLayout()
__hLayout.addWidget(self.__taskLabel)
__hLayout.addWidget(self.__progressBar)
__hLayout.addWidget(self.__cancelButton)
__vLayout = QtWidgets.QVBoxLayout(self)
__vLayout.addLayout(__hLayout)
__vLayout.addWidget(self.__subTaskLabel)
__vLayout.addStretch()
self.setLayout(__vLayout)
self.__cancelled = False
self.__progress = 0
self.__maxProgress = 100
QProgressTaskDialog.py 文件源码
python
阅读 109
收藏 0
点赞 0
评论 0
评论列表
文章目录