eric6/E5Gui/E5ProgressDialog.py

Sat, 27 Feb 2021 12:08:23 +0100

author
Detlev Offenbach <detlev@die-offenbachs.de>
date
Sat, 27 Feb 2021 12:08:23 +0100
changeset 8138
169e65a6787c
parent 7923
91e843545d9a
child 8043
0acf98cd089a
child 8218
7c09585bd960
permissions
-rw-r--r--

Shell: added functionality to show a prompt when the main client process has exited (e.g. a script ended).

3071
83d066710d60 Added an extended progress dialog to make the progress bar label more descriptive.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
1 # -*- coding: utf-8 -*-
83d066710d60 Added an extended progress dialog to make the progress bar label more descriptive.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
2
7923
91e843545d9a Updated copyright for 2021.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7900
diff changeset
3 # Copyright (c) 2013 - 2021 Detlev Offenbach <detlev@die-offenbachs.de>
3071
83d066710d60 Added an extended progress dialog to make the progress bar label more descriptive.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
4 #
83d066710d60 Added an extended progress dialog to make the progress bar label more descriptive.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
5
83d066710d60 Added an extended progress dialog to make the progress bar label more descriptive.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
6 """
83d066710d60 Added an extended progress dialog to make the progress bar label more descriptive.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
7 Module implementing a progress dialog allowing a customized progress bar label.
83d066710d60 Added an extended progress dialog to make the progress bar label more descriptive.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
8 """
83d066710d60 Added an extended progress dialog to make the progress bar label more descriptive.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
9
3656
441956d8fce5 Started porting eric5 to PyQt5.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 3178
diff changeset
10 from PyQt5.QtCore import Qt
441956d8fce5 Started porting eric5 to PyQt5.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 3178
diff changeset
11 from PyQt5.QtWidgets import QProgressBar, QProgressDialog
3071
83d066710d60 Added an extended progress dialog to make the progress bar label more descriptive.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
12
83d066710d60 Added an extended progress dialog to make the progress bar label more descriptive.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
13
83d066710d60 Added an extended progress dialog to make the progress bar label more descriptive.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
14 class E5ProgressDialog(QProgressDialog):
83d066710d60 Added an extended progress dialog to make the progress bar label more descriptive.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
15 """
83d066710d60 Added an extended progress dialog to make the progress bar label more descriptive.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
16 Class implementing a progress dialog allowing a customized progress bar
83d066710d60 Added an extended progress dialog to make the progress bar label more descriptive.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
17 label.
83d066710d60 Added an extended progress dialog to make the progress bar label more descriptive.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
18 """
83d066710d60 Added an extended progress dialog to make the progress bar label more descriptive.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
19 def __init__(self, labelText, cancelButtonText, minimum, maximum,
5653
c023821bb25f Fixed a few code style issues related to the usage of class instances for default arguments.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 5587
diff changeset
20 labelFormat=None, parent=None, flags=None):
3071
83d066710d60 Added an extended progress dialog to make the progress bar label more descriptive.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
21 """
83d066710d60 Added an extended progress dialog to make the progress bar label more descriptive.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
22 Constructor
83d066710d60 Added an extended progress dialog to make the progress bar label more descriptive.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
23
83d066710d60 Added an extended progress dialog to make the progress bar label more descriptive.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
24 @param labelText text of the dialog label (string)
83d066710d60 Added an extended progress dialog to make the progress bar label more descriptive.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
25 @param cancelButtonText text of the cancel button (string)
83d066710d60 Added an extended progress dialog to make the progress bar label more descriptive.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
26 @param minimum minimum value (integer)
83d066710d60 Added an extended progress dialog to make the progress bar label more descriptive.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
27 @param maximum maximum value (integer)
7900
72b88fb20261 Corrected the use of '@keyparam' in the source documentation.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7780
diff changeset
28 @param labelFormat label format of the progress bar (string)
72b88fb20261 Corrected the use of '@keyparam' in the source documentation.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7780
diff changeset
29 @param parent reference to the parent widget (QWidget)
72b88fb20261 Corrected the use of '@keyparam' in the source documentation.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7780
diff changeset
30 @param flags window flags of the dialog (Qt.WindowFlags)
3071
83d066710d60 Added an extended progress dialog to make the progress bar label more descriptive.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
31 """
5653
c023821bb25f Fixed a few code style issues related to the usage of class instances for default arguments.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 5587
diff changeset
32 if flags is None:
c023821bb25f Fixed a few code style issues related to the usage of class instances for default arguments.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 5587
diff changeset
33 flags = Qt.WindowFlags()
3088
7f1e291875d9 Fixed a coding style issue.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 3080
diff changeset
34 super(E5ProgressDialog, self).__init__(
7f1e291875d9 Fixed a coding style issue.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 3080
diff changeset
35 labelText, cancelButtonText, minimum, maximum, parent, flags)
3071
83d066710d60 Added an extended progress dialog to make the progress bar label more descriptive.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
36
83d066710d60 Added an extended progress dialog to make the progress bar label more descriptive.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
37 self.__progressBar = QProgressBar(self)
83d066710d60 Added an extended progress dialog to make the progress bar label more descriptive.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
38 self.__progressBar.setMinimum(minimum)
83d066710d60 Added an extended progress dialog to make the progress bar label more descriptive.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
39 self.__progressBar.setMaximum(maximum)
5587
ea526b78ee6c Started to fix code style issues detected by the extended style checker.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 5389
diff changeset
40 if labelFormat:
ea526b78ee6c Started to fix code style issues detected by the extended style checker.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 5389
diff changeset
41 self.__progressBar.setFormat(labelFormat)
3071
83d066710d60 Added an extended progress dialog to make the progress bar label more descriptive.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
42
83d066710d60 Added an extended progress dialog to make the progress bar label more descriptive.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
43 self.setBar(self.__progressBar)
83d066710d60 Added an extended progress dialog to make the progress bar label more descriptive.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
44
83d066710d60 Added an extended progress dialog to make the progress bar label more descriptive.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
45 def format(self):
83d066710d60 Added an extended progress dialog to make the progress bar label more descriptive.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
46 """
83d066710d60 Added an extended progress dialog to make the progress bar label more descriptive.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
47 Public method to get the progress bar format.
83d066710d60 Added an extended progress dialog to make the progress bar label more descriptive.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
48
83d066710d60 Added an extended progress dialog to make the progress bar label more descriptive.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
49 @return progress bar format (string)
83d066710d60 Added an extended progress dialog to make the progress bar label more descriptive.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
50 """
83d066710d60 Added an extended progress dialog to make the progress bar label more descriptive.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
51 return self.__progressBar.format()
83d066710d60 Added an extended progress dialog to make the progress bar label more descriptive.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
52
5587
ea526b78ee6c Started to fix code style issues detected by the extended style checker.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 5389
diff changeset
53 def setFormat(self, labelFormat):
3071
83d066710d60 Added an extended progress dialog to make the progress bar label more descriptive.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
54 """
83d066710d60 Added an extended progress dialog to make the progress bar label more descriptive.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
55 Public method to set the progress bar format.
83d066710d60 Added an extended progress dialog to make the progress bar label more descriptive.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
56
5587
ea526b78ee6c Started to fix code style issues detected by the extended style checker.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 5389
diff changeset
57 @param labelFormat progress bar format (string)
3071
83d066710d60 Added an extended progress dialog to make the progress bar label more descriptive.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
58 """
5587
ea526b78ee6c Started to fix code style issues detected by the extended style checker.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 5389
diff changeset
59 self.__progressBar.setFormat(labelFormat)

eric ide

mercurial