eric6/E5Gui/E5ProgressDialog.py

changeset 6942
2602857055c5
parent 6645
ad476851d7e0
child 7229
53054eb5b15a
equal deleted inserted replaced
6941:f99d60d6b59b 6942:2602857055c5
1 # -*- coding: utf-8 -*-
2
3 # Copyright (c) 2013 - 2019 Detlev Offenbach <detlev@die-offenbachs.de>
4 #
5
6 """
7 Module implementing a progress dialog allowing a customized progress bar label.
8 """
9
10 from __future__ import unicode_literals
11
12 from PyQt5.QtCore import Qt
13 from PyQt5.QtWidgets import QProgressBar, QProgressDialog
14
15
16 class E5ProgressDialog(QProgressDialog):
17 """
18 Class implementing a progress dialog allowing a customized progress bar
19 label.
20 """
21 def __init__(self, labelText, cancelButtonText, minimum, maximum,
22 labelFormat=None, parent=None, flags=None):
23 """
24 Constructor
25
26 @param labelText text of the dialog label (string)
27 @param cancelButtonText text of the cancel button (string)
28 @param minimum minimum value (integer)
29 @param maximum maximum value (integer)
30 @keyparam labelFormat label format of the progress bar (string)
31 @keyparam parent reference to the parent widget (QWidget)
32 @keyparam flags window flags of the dialog (Qt.WindowFlags)
33 """
34 if flags is None:
35 flags = Qt.WindowFlags()
36 super(E5ProgressDialog, self).__init__(
37 labelText, cancelButtonText, minimum, maximum, parent, flags)
38
39 self.__progressBar = QProgressBar(self)
40 self.__progressBar.setMinimum(minimum)
41 self.__progressBar.setMaximum(maximum)
42 if labelFormat:
43 self.__progressBar.setFormat(labelFormat)
44
45 self.setBar(self.__progressBar)
46
47 def format(self):
48 """
49 Public method to get the progress bar format.
50
51 @return progress bar format (string)
52 """
53 return self.__progressBar.format()
54
55 def setFormat(self, labelFormat):
56 """
57 Public method to set the progress bar format.
58
59 @param labelFormat progress bar format (string)
60 """
61 self.__progressBar.setFormat(labelFormat)

eric ide

mercurial