E5Gui/E5ProgressDialog.py

branch
Py2 comp.
changeset 3080
6c0a430b19df
parent 3071
83d066710d60
child 3088
7f1e291875d9
equal deleted inserted replaced
3079:0233bbe9a9c4 3080:6c0a430b19df
1 # -*- coding: utf-8 -*-
2
3 # Copyright (c) 2013 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 # __IGNORE_WARNING__
11
12 from PyQt4.QtCore import Qt
13 from PyQt4.QtGui 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 format=None, parent=None, flags=Qt.WindowFlags()):
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 format 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 super(E5ProgressDialog, self).__init__(labelText, cancelButtonText, minimum, maximum,
35 parent, flags)
36
37 self.__progressBar = QProgressBar(self)
38 self.__progressBar.setMinimum(minimum)
39 self.__progressBar.setMaximum(maximum)
40 if format:
41 self.__progressBar.setFormat(format)
42
43 self.setBar(self.__progressBar)
44
45 def format(self):
46 """
47 Public method to get the progress bar format.
48
49 @return progress bar format (string)
50 """
51 return self.__progressBar.format()
52
53 def setFormat(self, format):
54 """
55 Public method to set the progress bar format.
56
57 @param format progress bar format (string)
58 """
59 self.__progressBar.setFormat(format)

eric ide

mercurial