Mon, 13 Feb 2023 17:51:03 +0100
Modified the EricMessageBox okToClearData() function for more flexibility.
536
6d8d39753c82
Started replaceing QMessageBox methods with own methods.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
1 | # -*- coding: utf-8 -*- |
6d8d39753c82
Started replaceing QMessageBox methods with own methods.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
2 | |
9653
e67609152c5e
Updated copyright for 2023.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9473
diff
changeset
|
3 | # Copyright (c) 2010 - 2023 Detlev Offenbach <detlev@die-offenbachs.de> |
536
6d8d39753c82
Started replaceing QMessageBox methods with own methods.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
4 | # |
6d8d39753c82
Started replaceing QMessageBox methods with own methods.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
5 | |
6d8d39753c82
Started replaceing QMessageBox methods with own methods.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
6 | """ |
6d8d39753c82
Started replaceing QMessageBox methods with own methods.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
7 | Module implementing QMessageBox replacements and more convenience function. |
6d8d39753c82
Started replaceing QMessageBox methods with own methods.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
8 | """ |
6d8d39753c82
Started replaceing QMessageBox methods with own methods.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
9 | |
8318
962bce857696
Replaced all imports of PyQt5 to PyQt6 and started to replace code using obsoleted methods and adapt to the PyQt6 enum usage.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
8312
diff
changeset
|
10 | from PyQt6.QtCore import Qt |
9473
3f23dbf37dbe
Resorted the import statements using isort.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9221
diff
changeset
|
11 | from PyQt6.QtWidgets import QApplication, QMessageBox |
536
6d8d39753c82
Started replaceing QMessageBox methods with own methods.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
12 | |
2990
583beaf0b4b8
Continued to shorten the code lines to max. 79 characters.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
2302
diff
changeset
|
13 | ############################################################################### |
583beaf0b4b8
Continued to shorten the code lines to max. 79 characters.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
2302
diff
changeset
|
14 | ## Mappings to standard QMessageBox ## |
583beaf0b4b8
Continued to shorten the code lines to max. 79 characters.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
2302
diff
changeset
|
15 | ############################################################################### |
553
5af61623ae3c
Continued replacing QMessageBox methods with own methods.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
550
diff
changeset
|
16 | |
5af61623ae3c
Continued replacing QMessageBox methods with own methods.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
550
diff
changeset
|
17 | # QMessageBox.Icon |
8143
2c730d5fd177
Changed the use of PyQt enums because the way they were used previously is deprecated since two years and replaced some deprecated Qt stuff.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
7923
diff
changeset
|
18 | NoIcon = QMessageBox.Icon.NoIcon |
2c730d5fd177
Changed the use of PyQt enums because the way they were used previously is deprecated since two years and replaced some deprecated Qt stuff.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
7923
diff
changeset
|
19 | Critical = QMessageBox.Icon.Critical |
2c730d5fd177
Changed the use of PyQt enums because the way they were used previously is deprecated since two years and replaced some deprecated Qt stuff.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
7923
diff
changeset
|
20 | Information = QMessageBox.Icon.Information |
2c730d5fd177
Changed the use of PyQt enums because the way they were used previously is deprecated since two years and replaced some deprecated Qt stuff.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
7923
diff
changeset
|
21 | Question = QMessageBox.Icon.Question |
9221
bf71ee032bb4
Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9209
diff
changeset
|
22 | Warning = QMessageBox.Icon.Warning # __IGNORE_WARNING_M131__ |
553
5af61623ae3c
Continued replacing QMessageBox methods with own methods.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
550
diff
changeset
|
23 | |
5af61623ae3c
Continued replacing QMessageBox methods with own methods.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
550
diff
changeset
|
24 | # QMessageBox.StandardButton |
8143
2c730d5fd177
Changed the use of PyQt enums because the way they were used previously is deprecated since two years and replaced some deprecated Qt stuff.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
7923
diff
changeset
|
25 | Abort = QMessageBox.StandardButton.Abort |
2c730d5fd177
Changed the use of PyQt enums because the way they were used previously is deprecated since two years and replaced some deprecated Qt stuff.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
7923
diff
changeset
|
26 | Apply = QMessageBox.StandardButton.Apply |
2c730d5fd177
Changed the use of PyQt enums because the way they were used previously is deprecated since two years and replaced some deprecated Qt stuff.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
7923
diff
changeset
|
27 | Cancel = QMessageBox.StandardButton.Cancel |
2c730d5fd177
Changed the use of PyQt enums because the way they were used previously is deprecated since two years and replaced some deprecated Qt stuff.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
7923
diff
changeset
|
28 | Close = QMessageBox.StandardButton.Close |
2c730d5fd177
Changed the use of PyQt enums because the way they were used previously is deprecated since two years and replaced some deprecated Qt stuff.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
7923
diff
changeset
|
29 | Discard = QMessageBox.StandardButton.Discard |
2c730d5fd177
Changed the use of PyQt enums because the way they were used previously is deprecated since two years and replaced some deprecated Qt stuff.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
7923
diff
changeset
|
30 | Help = QMessageBox.StandardButton.Help |
2c730d5fd177
Changed the use of PyQt enums because the way they were used previously is deprecated since two years and replaced some deprecated Qt stuff.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
7923
diff
changeset
|
31 | Ignore = QMessageBox.StandardButton.Ignore |
2c730d5fd177
Changed the use of PyQt enums because the way they were used previously is deprecated since two years and replaced some deprecated Qt stuff.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
7923
diff
changeset
|
32 | No = QMessageBox.StandardButton.No |
2c730d5fd177
Changed the use of PyQt enums because the way they were used previously is deprecated since two years and replaced some deprecated Qt stuff.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
7923
diff
changeset
|
33 | NoToAll = QMessageBox.StandardButton.NoToAll |
2c730d5fd177
Changed the use of PyQt enums because the way they were used previously is deprecated since two years and replaced some deprecated Qt stuff.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
7923
diff
changeset
|
34 | Ok = QMessageBox.StandardButton.Ok |
2c730d5fd177
Changed the use of PyQt enums because the way they were used previously is deprecated since two years and replaced some deprecated Qt stuff.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
7923
diff
changeset
|
35 | Open = QMessageBox.StandardButton.Open |
2c730d5fd177
Changed the use of PyQt enums because the way they were used previously is deprecated since two years and replaced some deprecated Qt stuff.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
7923
diff
changeset
|
36 | Reset = QMessageBox.StandardButton.Reset |
2c730d5fd177
Changed the use of PyQt enums because the way they were used previously is deprecated since two years and replaced some deprecated Qt stuff.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
7923
diff
changeset
|
37 | RestoreDefaults = QMessageBox.StandardButton.RestoreDefaults |
2c730d5fd177
Changed the use of PyQt enums because the way they were used previously is deprecated since two years and replaced some deprecated Qt stuff.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
7923
diff
changeset
|
38 | Retry = QMessageBox.StandardButton.Retry |
2c730d5fd177
Changed the use of PyQt enums because the way they were used previously is deprecated since two years and replaced some deprecated Qt stuff.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
7923
diff
changeset
|
39 | Save = QMessageBox.StandardButton.Save |
2c730d5fd177
Changed the use of PyQt enums because the way they were used previously is deprecated since two years and replaced some deprecated Qt stuff.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
7923
diff
changeset
|
40 | SaveAll = QMessageBox.StandardButton.SaveAll |
2c730d5fd177
Changed the use of PyQt enums because the way they were used previously is deprecated since two years and replaced some deprecated Qt stuff.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
7923
diff
changeset
|
41 | Yes = QMessageBox.StandardButton.Yes |
2c730d5fd177
Changed the use of PyQt enums because the way they were used previously is deprecated since two years and replaced some deprecated Qt stuff.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
7923
diff
changeset
|
42 | YesToAll = QMessageBox.StandardButton.YesToAll |
2c730d5fd177
Changed the use of PyQt enums because the way they were used previously is deprecated since two years and replaced some deprecated Qt stuff.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
7923
diff
changeset
|
43 | NoButton = QMessageBox.StandardButton.NoButton |
553
5af61623ae3c
Continued replacing QMessageBox methods with own methods.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
550
diff
changeset
|
44 | |
5af61623ae3c
Continued replacing QMessageBox methods with own methods.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
550
diff
changeset
|
45 | # QMessageBox.ButtonRole |
8143
2c730d5fd177
Changed the use of PyQt enums because the way they were used previously is deprecated since two years and replaced some deprecated Qt stuff.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
7923
diff
changeset
|
46 | AcceptRole = QMessageBox.ButtonRole.AcceptRole |
2c730d5fd177
Changed the use of PyQt enums because the way they were used previously is deprecated since two years and replaced some deprecated Qt stuff.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
7923
diff
changeset
|
47 | ActionRole = QMessageBox.ButtonRole.ActionRole |
2c730d5fd177
Changed the use of PyQt enums because the way they were used previously is deprecated since two years and replaced some deprecated Qt stuff.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
7923
diff
changeset
|
48 | ApplyRole = QMessageBox.ButtonRole.ApplyRole |
2c730d5fd177
Changed the use of PyQt enums because the way they were used previously is deprecated since two years and replaced some deprecated Qt stuff.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
7923
diff
changeset
|
49 | DestructiveRole = QMessageBox.ButtonRole.DestructiveRole |
2c730d5fd177
Changed the use of PyQt enums because the way they were used previously is deprecated since two years and replaced some deprecated Qt stuff.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
7923
diff
changeset
|
50 | InvalidRole = QMessageBox.ButtonRole.InvalidRole |
2c730d5fd177
Changed the use of PyQt enums because the way they were used previously is deprecated since two years and replaced some deprecated Qt stuff.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
7923
diff
changeset
|
51 | HelpRole = QMessageBox.ButtonRole.HelpRole |
2c730d5fd177
Changed the use of PyQt enums because the way they were used previously is deprecated since two years and replaced some deprecated Qt stuff.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
7923
diff
changeset
|
52 | NoRole = QMessageBox.ButtonRole.NoRole |
2c730d5fd177
Changed the use of PyQt enums because the way they were used previously is deprecated since two years and replaced some deprecated Qt stuff.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
7923
diff
changeset
|
53 | RejectRole = QMessageBox.ButtonRole.RejectRole |
2c730d5fd177
Changed the use of PyQt enums because the way they were used previously is deprecated since two years and replaced some deprecated Qt stuff.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
7923
diff
changeset
|
54 | ResetRole = QMessageBox.ButtonRole.ResetRole |
2c730d5fd177
Changed the use of PyQt enums because the way they were used previously is deprecated since two years and replaced some deprecated Qt stuff.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
7923
diff
changeset
|
55 | YesRole = QMessageBox.ButtonRole.YesRole |
553
5af61623ae3c
Continued replacing QMessageBox methods with own methods.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
550
diff
changeset
|
56 | |
2990
583beaf0b4b8
Continued to shorten the code lines to max. 79 characters.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
2302
diff
changeset
|
57 | ############################################################################### |
583beaf0b4b8
Continued to shorten the code lines to max. 79 characters.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
2302
diff
changeset
|
58 | ## Replacement for the QMessageBox class ## |
583beaf0b4b8
Continued to shorten the code lines to max. 79 characters.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
2302
diff
changeset
|
59 | ############################################################################### |
553
5af61623ae3c
Continued replacing QMessageBox methods with own methods.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
550
diff
changeset
|
60 | |
945
8cd4d08fa9f6
Made code mostly PEP 8 compliant (except all whitespace and line length).
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
791
diff
changeset
|
61 | |
8356
68ec9c3d4de5
Renamed the modules and classes of the E5Gui package to have the prefix 'Eric' instead of 'E5'.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
8318
diff
changeset
|
62 | class EricMessageBox(QMessageBox): |
553
5af61623ae3c
Continued replacing QMessageBox methods with own methods.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
550
diff
changeset
|
63 | """ |
5af61623ae3c
Continued replacing QMessageBox methods with own methods.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
550
diff
changeset
|
64 | Class implementing a replacement for QMessageBox. |
5af61623ae3c
Continued replacing QMessageBox methods with own methods.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
550
diff
changeset
|
65 | """ |
9221
bf71ee032bb4
Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9209
diff
changeset
|
66 | |
bf71ee032bb4
Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9209
diff
changeset
|
67 | def __init__( |
bf71ee032bb4
Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9209
diff
changeset
|
68 | self, |
bf71ee032bb4
Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9209
diff
changeset
|
69 | icon, |
bf71ee032bb4
Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9209
diff
changeset
|
70 | title, |
bf71ee032bb4
Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9209
diff
changeset
|
71 | text, |
bf71ee032bb4
Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9209
diff
changeset
|
72 | modal=False, |
bf71ee032bb4
Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9209
diff
changeset
|
73 | buttons=QMessageBox.StandardButton.NoButton, |
bf71ee032bb4
Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9209
diff
changeset
|
74 | parent=None, |
bf71ee032bb4
Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9209
diff
changeset
|
75 | ): |
553
5af61623ae3c
Continued replacing QMessageBox methods with own methods.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
550
diff
changeset
|
76 | """ |
5af61623ae3c
Continued replacing QMessageBox methods with own methods.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
550
diff
changeset
|
77 | Constructor |
9221
bf71ee032bb4
Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9209
diff
changeset
|
78 | |
553
5af61623ae3c
Continued replacing QMessageBox methods with own methods.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
550
diff
changeset
|
79 | @param icon type of icon to be shown (QMessageBox.Icon) |
5af61623ae3c
Continued replacing QMessageBox methods with own methods.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
550
diff
changeset
|
80 | @param title caption of the message box (string) |
5af61623ae3c
Continued replacing QMessageBox methods with own methods.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
550
diff
changeset
|
81 | @param text text to be shown by the message box (string) |
7900
72b88fb20261
Corrected the use of '@keyparam' in the source documentation.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
7780
diff
changeset
|
82 | @param modal flag indicating a modal dialog (boolean) |
72b88fb20261
Corrected the use of '@keyparam' in the source documentation.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
7780
diff
changeset
|
83 | @param buttons set of standard buttons to generate (StandardButtons) |
72b88fb20261
Corrected the use of '@keyparam' in the source documentation.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
7780
diff
changeset
|
84 | @param parent parent widget of the message box (QWidget) |
553
5af61623ae3c
Continued replacing QMessageBox methods with own methods.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
550
diff
changeset
|
85 | """ |
8218
7c09585bd960
Applied some more code simplifications suggested by the new Simplify checker (super(Foo, self) => super()).
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
8143
diff
changeset
|
86 | super().__init__(parent) |
553
5af61623ae3c
Continued replacing QMessageBox methods with own methods.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
550
diff
changeset
|
87 | self.setIcon(icon) |
588
573767cf6bde
Fixed an issue in E5MessageBox.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
564
diff
changeset
|
88 | if modal: |
573767cf6bde
Fixed an issue in E5MessageBox.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
564
diff
changeset
|
89 | if parent is not None: |
8143
2c730d5fd177
Changed the use of PyQt enums because the way they were used previously is deprecated since two years and replaced some deprecated Qt stuff.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
7923
diff
changeset
|
90 | self.setWindowModality(Qt.WindowModality.WindowModal) |
588
573767cf6bde
Fixed an issue in E5MessageBox.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
564
diff
changeset
|
91 | else: |
8143
2c730d5fd177
Changed the use of PyQt enums because the way they were used previously is deprecated since two years and replaced some deprecated Qt stuff.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
7923
diff
changeset
|
92 | self.setWindowModality(Qt.WindowModality.ApplicationModal) |
588
573767cf6bde
Fixed an issue in E5MessageBox.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
564
diff
changeset
|
93 | else: |
8143
2c730d5fd177
Changed the use of PyQt enums because the way they were used previously is deprecated since two years and replaced some deprecated Qt stuff.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
7923
diff
changeset
|
94 | self.setWindowModality(Qt.WindowModality.NonModal) |
564
b3d966393ba9
Did some code cleanup.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
562
diff
changeset
|
95 | if title == "": |
9221
bf71ee032bb4
Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9209
diff
changeset
|
96 | self.setWindowTitle("{0}".format(QApplication.applicationName())) |
564
b3d966393ba9
Did some code cleanup.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
562
diff
changeset
|
97 | else: |
9221
bf71ee032bb4
Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9209
diff
changeset
|
98 | self.setWindowTitle( |
bf71ee032bb4
Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9209
diff
changeset
|
99 | "{0} - {1}".format(QApplication.applicationName(), title) |
bf71ee032bb4
Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9209
diff
changeset
|
100 | ) |
553
5af61623ae3c
Continued replacing QMessageBox methods with own methods.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
550
diff
changeset
|
101 | self.setText(text) |
564
b3d966393ba9
Did some code cleanup.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
562
diff
changeset
|
102 | self.setStandardButtons(buttons) |
553
5af61623ae3c
Continued replacing QMessageBox methods with own methods.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
550
diff
changeset
|
103 | |
9221
bf71ee032bb4
Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9209
diff
changeset
|
104 | |
2990
583beaf0b4b8
Continued to shorten the code lines to max. 79 characters.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
2302
diff
changeset
|
105 | ############################################################################### |
583beaf0b4b8
Continued to shorten the code lines to max. 79 characters.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
2302
diff
changeset
|
106 | ## Replacements for QMessageBox static methods ## |
583beaf0b4b8
Continued to shorten the code lines to max. 79 characters.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
2302
diff
changeset
|
107 | ############################################################################### |
553
5af61623ae3c
Continued replacing QMessageBox methods with own methods.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
550
diff
changeset
|
108 | |
945
8cd4d08fa9f6
Made code mostly PEP 8 compliant (except all whitespace and line length).
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
791
diff
changeset
|
109 | |
9221
bf71ee032bb4
Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9209
diff
changeset
|
110 | def __messageBox( |
bf71ee032bb4
Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9209
diff
changeset
|
111 | parent, |
bf71ee032bb4
Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9209
diff
changeset
|
112 | title, |
bf71ee032bb4
Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9209
diff
changeset
|
113 | text, |
bf71ee032bb4
Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9209
diff
changeset
|
114 | icon, |
bf71ee032bb4
Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9209
diff
changeset
|
115 | buttons=QMessageBox.StandardButton.Ok, |
bf71ee032bb4
Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9209
diff
changeset
|
116 | defaultButton=QMessageBox.StandardButton.NoButton, |
bf71ee032bb4
Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9209
diff
changeset
|
117 | textFormat=Qt.TextFormat.AutoText, |
bf71ee032bb4
Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9209
diff
changeset
|
118 | ): |
536
6d8d39753c82
Started replaceing QMessageBox methods with own methods.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
119 | """ |
537
72b32daeb8d6
Continued replacing QMessageBox methods with own methods.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
536
diff
changeset
|
120 | Private module function to show a modal message box. |
9221
bf71ee032bb4
Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9209
diff
changeset
|
121 | |
537
72b32daeb8d6
Continued replacing QMessageBox methods with own methods.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
536
diff
changeset
|
122 | @param parent parent widget of the message box (QWidget) |
72b32daeb8d6
Continued replacing QMessageBox methods with own methods.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
536
diff
changeset
|
123 | @param title caption of the message box (string) |
72b32daeb8d6
Continued replacing QMessageBox methods with own methods.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
536
diff
changeset
|
124 | @param text text to be shown by the message box (string) |
72b32daeb8d6
Continued replacing QMessageBox methods with own methods.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
536
diff
changeset
|
125 | @param icon type of icon to be shown (QMessageBox.Icon) |
945
8cd4d08fa9f6
Made code mostly PEP 8 compliant (except all whitespace and line length).
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
791
diff
changeset
|
126 | @param buttons flags indicating which buttons to show |
536
6d8d39753c82
Started replaceing QMessageBox methods with own methods.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
127 | (QMessageBox.StandardButtons) |
6d8d39753c82
Started replaceing QMessageBox methods with own methods.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
128 | @param defaultButton flag indicating the default button |
6d8d39753c82
Started replaceing QMessageBox methods with own methods.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
129 | (QMessageBox.StandardButton) |
1366
f2e7957924cb
Fixed a security issue using QLabel for showing SSL certificate infos without setting the label's text format to Qt.PlainText.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
1131
diff
changeset
|
130 | @param textFormat format of the text (Qt.TextFormat) |
562
8bf0dbc1ca6a
Added a wizard for the eric5 message box (E5MessageBox).
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
553
diff
changeset
|
131 | @return button pressed by the user (QMessageBox.StandardButton) |
536
6d8d39753c82
Started replaceing QMessageBox methods with own methods.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
132 | """ |
6d8d39753c82
Started replaceing QMessageBox methods with own methods.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
133 | messageBox = QMessageBox(parent) |
537
72b32daeb8d6
Continued replacing QMessageBox methods with own methods.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
536
diff
changeset
|
134 | messageBox.setIcon(icon) |
536
6d8d39753c82
Started replaceing QMessageBox methods with own methods.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
135 | if parent is not None: |
8143
2c730d5fd177
Changed the use of PyQt enums because the way they were used previously is deprecated since two years and replaced some deprecated Qt stuff.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
7923
diff
changeset
|
136 | messageBox.setWindowModality(Qt.WindowModality.WindowModal) |
564
b3d966393ba9
Did some code cleanup.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
562
diff
changeset
|
137 | if title == "": |
9221
bf71ee032bb4
Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9209
diff
changeset
|
138 | messageBox.setWindowTitle("{0}".format(QApplication.applicationName())) |
564
b3d966393ba9
Did some code cleanup.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
562
diff
changeset
|
139 | else: |
9221
bf71ee032bb4
Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9209
diff
changeset
|
140 | messageBox.setWindowTitle( |
bf71ee032bb4
Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9209
diff
changeset
|
141 | "{0} - {1}".format(QApplication.applicationName(), title) |
bf71ee032bb4
Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9209
diff
changeset
|
142 | ) |
1366
f2e7957924cb
Fixed a security issue using QLabel for showing SSL certificate infos without setting the label's text format to Qt.PlainText.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
1131
diff
changeset
|
143 | messageBox.setTextFormat(textFormat) |
536
6d8d39753c82
Started replaceing QMessageBox methods with own methods.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
144 | messageBox.setText(text) |
6d8d39753c82
Started replaceing QMessageBox methods with own methods.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
145 | messageBox.setStandardButtons(buttons) |
6d8d39753c82
Started replaceing QMessageBox methods with own methods.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
146 | messageBox.setDefaultButton(defaultButton) |
7759
51aa6c6b66f7
Changed calls to exec_() into exec() (remainder of Python2 elimination).
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
7628
diff
changeset
|
147 | messageBox.exec() |
536
6d8d39753c82
Started replaceing QMessageBox methods with own methods.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
148 | clickedButton = messageBox.clickedButton() |
6d8d39753c82
Started replaceing QMessageBox methods with own methods.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
149 | if clickedButton is None: |
8143
2c730d5fd177
Changed the use of PyQt enums because the way they were used previously is deprecated since two years and replaced some deprecated Qt stuff.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
7923
diff
changeset
|
150 | return QMessageBox.StandardButton.NoButton |
536
6d8d39753c82
Started replaceing QMessageBox methods with own methods.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
151 | else: |
6d8d39753c82
Started replaceing QMessageBox methods with own methods.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
152 | return messageBox.standardButton(clickedButton) |
537
72b32daeb8d6
Continued replacing QMessageBox methods with own methods.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
536
diff
changeset
|
153 | |
9221
bf71ee032bb4
Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9209
diff
changeset
|
154 | |
545
1538031b5175
Continued replacing QMessageBox.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
541
diff
changeset
|
155 | # the about functions are here for consistancy |
1538031b5175
Continued replacing QMessageBox.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
541
diff
changeset
|
156 | about = QMessageBox.about |
1538031b5175
Continued replacing QMessageBox.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
541
diff
changeset
|
157 | aboutQt = QMessageBox.aboutQt |
1538031b5175
Continued replacing QMessageBox.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
541
diff
changeset
|
158 | |
945
8cd4d08fa9f6
Made code mostly PEP 8 compliant (except all whitespace and line length).
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
791
diff
changeset
|
159 | |
9221
bf71ee032bb4
Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9209
diff
changeset
|
160 | def critical( |
bf71ee032bb4
Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9209
diff
changeset
|
161 | parent, |
bf71ee032bb4
Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9209
diff
changeset
|
162 | title, |
bf71ee032bb4
Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9209
diff
changeset
|
163 | text, |
bf71ee032bb4
Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9209
diff
changeset
|
164 | buttons=QMessageBox.StandardButton.Ok, |
bf71ee032bb4
Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9209
diff
changeset
|
165 | defaultButton=QMessageBox.StandardButton.NoButton, |
bf71ee032bb4
Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9209
diff
changeset
|
166 | ): |
537
72b32daeb8d6
Continued replacing QMessageBox methods with own methods.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
536
diff
changeset
|
167 | """ |
72b32daeb8d6
Continued replacing QMessageBox methods with own methods.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
536
diff
changeset
|
168 | Function to show a modal critical message box. |
9221
bf71ee032bb4
Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9209
diff
changeset
|
169 | |
537
72b32daeb8d6
Continued replacing QMessageBox methods with own methods.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
536
diff
changeset
|
170 | @param parent parent widget of the message box (QWidget) |
72b32daeb8d6
Continued replacing QMessageBox methods with own methods.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
536
diff
changeset
|
171 | @param title caption of the message box (string) |
72b32daeb8d6
Continued replacing QMessageBox methods with own methods.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
536
diff
changeset
|
172 | @param text text to be shown by the message box (string) |
945
8cd4d08fa9f6
Made code mostly PEP 8 compliant (except all whitespace and line length).
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
791
diff
changeset
|
173 | @param buttons flags indicating which buttons to show |
537
72b32daeb8d6
Continued replacing QMessageBox methods with own methods.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
536
diff
changeset
|
174 | (QMessageBox.StandardButtons) |
72b32daeb8d6
Continued replacing QMessageBox methods with own methods.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
536
diff
changeset
|
175 | @param defaultButton flag indicating the default button |
72b32daeb8d6
Continued replacing QMessageBox methods with own methods.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
536
diff
changeset
|
176 | (QMessageBox.StandardButton) |
562
8bf0dbc1ca6a
Added a wizard for the eric5 message box (E5MessageBox).
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
553
diff
changeset
|
177 | @return button pressed by the user (QMessageBox.StandardButton) |
537
72b32daeb8d6
Continued replacing QMessageBox methods with own methods.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
536
diff
changeset
|
178 | """ |
9221
bf71ee032bb4
Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9209
diff
changeset
|
179 | return __messageBox( |
bf71ee032bb4
Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9209
diff
changeset
|
180 | parent, title, text, QMessageBox.Icon.Critical, buttons, defaultButton |
bf71ee032bb4
Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9209
diff
changeset
|
181 | ) |
537
72b32daeb8d6
Continued replacing QMessageBox methods with own methods.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
536
diff
changeset
|
182 | |
945
8cd4d08fa9f6
Made code mostly PEP 8 compliant (except all whitespace and line length).
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
791
diff
changeset
|
183 | |
9221
bf71ee032bb4
Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9209
diff
changeset
|
184 | def information( |
bf71ee032bb4
Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9209
diff
changeset
|
185 | parent, |
bf71ee032bb4
Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9209
diff
changeset
|
186 | title, |
bf71ee032bb4
Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9209
diff
changeset
|
187 | text, |
bf71ee032bb4
Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9209
diff
changeset
|
188 | buttons=QMessageBox.StandardButton.Ok, |
bf71ee032bb4
Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9209
diff
changeset
|
189 | defaultButton=QMessageBox.StandardButton.NoButton, |
bf71ee032bb4
Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9209
diff
changeset
|
190 | ): |
537
72b32daeb8d6
Continued replacing QMessageBox methods with own methods.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
536
diff
changeset
|
191 | """ |
72b32daeb8d6
Continued replacing QMessageBox methods with own methods.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
536
diff
changeset
|
192 | Function to show a modal information message box. |
9221
bf71ee032bb4
Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9209
diff
changeset
|
193 | |
537
72b32daeb8d6
Continued replacing QMessageBox methods with own methods.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
536
diff
changeset
|
194 | @param parent parent widget of the message box (QWidget) |
72b32daeb8d6
Continued replacing QMessageBox methods with own methods.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
536
diff
changeset
|
195 | @param title caption of the message box (string) |
72b32daeb8d6
Continued replacing QMessageBox methods with own methods.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
536
diff
changeset
|
196 | @param text text to be shown by the message box (string) |
945
8cd4d08fa9f6
Made code mostly PEP 8 compliant (except all whitespace and line length).
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
791
diff
changeset
|
197 | @param buttons flags indicating which buttons to show |
537
72b32daeb8d6
Continued replacing QMessageBox methods with own methods.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
536
diff
changeset
|
198 | (QMessageBox.StandardButtons) |
72b32daeb8d6
Continued replacing QMessageBox methods with own methods.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
536
diff
changeset
|
199 | @param defaultButton flag indicating the default button |
72b32daeb8d6
Continued replacing QMessageBox methods with own methods.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
536
diff
changeset
|
200 | (QMessageBox.StandardButton) |
562
8bf0dbc1ca6a
Added a wizard for the eric5 message box (E5MessageBox).
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
553
diff
changeset
|
201 | @return button pressed by the user (QMessageBox.StandardButton) |
537
72b32daeb8d6
Continued replacing QMessageBox methods with own methods.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
536
diff
changeset
|
202 | """ |
9221
bf71ee032bb4
Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9209
diff
changeset
|
203 | return __messageBox( |
bf71ee032bb4
Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9209
diff
changeset
|
204 | parent, title, text, QMessageBox.Icon.Information, buttons, defaultButton |
bf71ee032bb4
Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9209
diff
changeset
|
205 | ) |
537
72b32daeb8d6
Continued replacing QMessageBox methods with own methods.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
536
diff
changeset
|
206 | |
945
8cd4d08fa9f6
Made code mostly PEP 8 compliant (except all whitespace and line length).
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
791
diff
changeset
|
207 | |
9221
bf71ee032bb4
Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9209
diff
changeset
|
208 | def question( |
bf71ee032bb4
Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9209
diff
changeset
|
209 | parent, |
bf71ee032bb4
Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9209
diff
changeset
|
210 | title, |
bf71ee032bb4
Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9209
diff
changeset
|
211 | text, |
bf71ee032bb4
Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9209
diff
changeset
|
212 | buttons=QMessageBox.StandardButton.Ok, |
bf71ee032bb4
Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9209
diff
changeset
|
213 | defaultButton=QMessageBox.StandardButton.NoButton, |
bf71ee032bb4
Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9209
diff
changeset
|
214 | ): |
537
72b32daeb8d6
Continued replacing QMessageBox methods with own methods.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
536
diff
changeset
|
215 | """ |
72b32daeb8d6
Continued replacing QMessageBox methods with own methods.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
536
diff
changeset
|
216 | Function to show a modal question message box. |
9221
bf71ee032bb4
Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9209
diff
changeset
|
217 | |
537
72b32daeb8d6
Continued replacing QMessageBox methods with own methods.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
536
diff
changeset
|
218 | @param parent parent widget of the message box (QWidget) |
72b32daeb8d6
Continued replacing QMessageBox methods with own methods.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
536
diff
changeset
|
219 | @param title caption of the message box (string) |
72b32daeb8d6
Continued replacing QMessageBox methods with own methods.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
536
diff
changeset
|
220 | @param text text to be shown by the message box (string) |
945
8cd4d08fa9f6
Made code mostly PEP 8 compliant (except all whitespace and line length).
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
791
diff
changeset
|
221 | @param buttons flags indicating which buttons to show |
537
72b32daeb8d6
Continued replacing QMessageBox methods with own methods.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
536
diff
changeset
|
222 | (QMessageBox.StandardButtons) |
72b32daeb8d6
Continued replacing QMessageBox methods with own methods.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
536
diff
changeset
|
223 | @param defaultButton flag indicating the default button |
72b32daeb8d6
Continued replacing QMessageBox methods with own methods.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
536
diff
changeset
|
224 | (QMessageBox.StandardButton) |
562
8bf0dbc1ca6a
Added a wizard for the eric5 message box (E5MessageBox).
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
553
diff
changeset
|
225 | @return button pressed by the user (QMessageBox.StandardButton) |
537
72b32daeb8d6
Continued replacing QMessageBox methods with own methods.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
536
diff
changeset
|
226 | """ |
9221
bf71ee032bb4
Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9209
diff
changeset
|
227 | return __messageBox( |
bf71ee032bb4
Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9209
diff
changeset
|
228 | parent, title, text, QMessageBox.Icon.Question, buttons, defaultButton |
bf71ee032bb4
Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9209
diff
changeset
|
229 | ) |
537
72b32daeb8d6
Continued replacing QMessageBox methods with own methods.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
536
diff
changeset
|
230 | |
945
8cd4d08fa9f6
Made code mostly PEP 8 compliant (except all whitespace and line length).
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
791
diff
changeset
|
231 | |
9221
bf71ee032bb4
Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9209
diff
changeset
|
232 | def warning( |
bf71ee032bb4
Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9209
diff
changeset
|
233 | parent, |
bf71ee032bb4
Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9209
diff
changeset
|
234 | title, |
bf71ee032bb4
Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9209
diff
changeset
|
235 | text, |
bf71ee032bb4
Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9209
diff
changeset
|
236 | buttons=QMessageBox.StandardButton.Ok, |
bf71ee032bb4
Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9209
diff
changeset
|
237 | defaultButton=QMessageBox.StandardButton.NoButton, |
bf71ee032bb4
Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9209
diff
changeset
|
238 | ): |
537
72b32daeb8d6
Continued replacing QMessageBox methods with own methods.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
536
diff
changeset
|
239 | """ |
72b32daeb8d6
Continued replacing QMessageBox methods with own methods.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
536
diff
changeset
|
240 | Function to show a modal warning message box. |
9221
bf71ee032bb4
Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9209
diff
changeset
|
241 | |
537
72b32daeb8d6
Continued replacing QMessageBox methods with own methods.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
536
diff
changeset
|
242 | @param parent parent widget of the message box (QWidget) |
72b32daeb8d6
Continued replacing QMessageBox methods with own methods.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
536
diff
changeset
|
243 | @param title caption of the message box (string) |
72b32daeb8d6
Continued replacing QMessageBox methods with own methods.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
536
diff
changeset
|
244 | @param text text to be shown by the message box (string) |
945
8cd4d08fa9f6
Made code mostly PEP 8 compliant (except all whitespace and line length).
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
791
diff
changeset
|
245 | @param buttons flags indicating which buttons to show |
537
72b32daeb8d6
Continued replacing QMessageBox methods with own methods.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
536
diff
changeset
|
246 | (QMessageBox.StandardButtons) |
72b32daeb8d6
Continued replacing QMessageBox methods with own methods.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
536
diff
changeset
|
247 | @param defaultButton flag indicating the default button |
72b32daeb8d6
Continued replacing QMessageBox methods with own methods.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
536
diff
changeset
|
248 | (QMessageBox.StandardButton) |
562
8bf0dbc1ca6a
Added a wizard for the eric5 message box (E5MessageBox).
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
553
diff
changeset
|
249 | @return button pressed by the user (QMessageBox.StandardButton) |
537
72b32daeb8d6
Continued replacing QMessageBox methods with own methods.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
536
diff
changeset
|
250 | """ |
9221
bf71ee032bb4
Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9209
diff
changeset
|
251 | return __messageBox( |
bf71ee032bb4
Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9209
diff
changeset
|
252 | parent, title, text, QMessageBox.Icon.Warning, buttons, defaultButton |
bf71ee032bb4
Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9209
diff
changeset
|
253 | ) |
bf71ee032bb4
Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9209
diff
changeset
|
254 | |
541
00e1a5d060c5
Continued replacing QMessageBox methods with own methods.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
537
diff
changeset
|
255 | |
2990
583beaf0b4b8
Continued to shorten the code lines to max. 79 characters.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
2302
diff
changeset
|
256 | ############################################################################### |
583beaf0b4b8
Continued to shorten the code lines to max. 79 characters.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
2302
diff
changeset
|
257 | ## Additional convenience functions ## |
583beaf0b4b8
Continued to shorten the code lines to max. 79 characters.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
2302
diff
changeset
|
258 | ############################################################################### |
541
00e1a5d060c5
Continued replacing QMessageBox methods with own methods.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
537
diff
changeset
|
259 | |
945
8cd4d08fa9f6
Made code mostly PEP 8 compliant (except all whitespace and line length).
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
791
diff
changeset
|
260 | |
9221
bf71ee032bb4
Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9209
diff
changeset
|
261 | def yesNo( |
bf71ee032bb4
Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9209
diff
changeset
|
262 | parent, |
bf71ee032bb4
Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9209
diff
changeset
|
263 | title, |
bf71ee032bb4
Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9209
diff
changeset
|
264 | text, |
bf71ee032bb4
Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9209
diff
changeset
|
265 | icon=Question, |
bf71ee032bb4
Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9209
diff
changeset
|
266 | yesDefault=False, |
bf71ee032bb4
Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9209
diff
changeset
|
267 | textFormat=Qt.TextFormat.AutoText, |
bf71ee032bb4
Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9209
diff
changeset
|
268 | ): |
541
00e1a5d060c5
Continued replacing QMessageBox methods with own methods.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
537
diff
changeset
|
269 | """ |
00e1a5d060c5
Continued replacing QMessageBox methods with own methods.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
537
diff
changeset
|
270 | Function to show a model yes/no message box. |
9221
bf71ee032bb4
Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9209
diff
changeset
|
271 | |
541
00e1a5d060c5
Continued replacing QMessageBox methods with own methods.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
537
diff
changeset
|
272 | @param parent parent widget of the message box (QWidget) |
00e1a5d060c5
Continued replacing QMessageBox methods with own methods.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
537
diff
changeset
|
273 | @param title caption of the message box (string) |
00e1a5d060c5
Continued replacing QMessageBox methods with own methods.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
537
diff
changeset
|
274 | @param text text to be shown by the message box (string) |
7900
72b88fb20261
Corrected the use of '@keyparam' in the source documentation.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
7780
diff
changeset
|
275 | @param icon icon for the dialog (Critical, Information, Question or |
2990
583beaf0b4b8
Continued to shorten the code lines to max. 79 characters.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
2302
diff
changeset
|
276 | Warning) |
7900
72b88fb20261
Corrected the use of '@keyparam' in the source documentation.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
7780
diff
changeset
|
277 | @param yesDefault flag indicating that the Yes button should be the |
2990
583beaf0b4b8
Continued to shorten the code lines to max. 79 characters.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
2302
diff
changeset
|
278 | default button (boolean) |
1366
f2e7957924cb
Fixed a security issue using QLabel for showing SSL certificate infos without setting the label's text format to Qt.PlainText.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
1131
diff
changeset
|
279 | @param textFormat format of the text (Qt.TextFormat) |
541
00e1a5d060c5
Continued replacing QMessageBox methods with own methods.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
537
diff
changeset
|
280 | @return flag indicating the selection of the Yes button (boolean) |
7628
f904d0eef264
Checked the reported security related issue reports generated by the new security checker.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
7360
diff
changeset
|
281 | @exception ValueError raised to indicate a bad parameter value |
541
00e1a5d060c5
Continued replacing QMessageBox methods with own methods.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
537
diff
changeset
|
282 | """ |
7628
f904d0eef264
Checked the reported security related issue reports generated by the new security checker.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
7360
diff
changeset
|
283 | if icon not in [Critical, Information, Question, Warning]: |
f904d0eef264
Checked the reported security related issue reports generated by the new security checker.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
7360
diff
changeset
|
284 | raise ValueError("Bad value for 'icon' parameter.") |
9221
bf71ee032bb4
Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9209
diff
changeset
|
285 | |
3022
57179e4cdadd
Fixed a bunch of visible indentation issues.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
2990
diff
changeset
|
286 | res = __messageBox( |
9221
bf71ee032bb4
Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9209
diff
changeset
|
287 | parent, |
bf71ee032bb4
Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9209
diff
changeset
|
288 | title, |
bf71ee032bb4
Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9209
diff
changeset
|
289 | text, |
bf71ee032bb4
Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9209
diff
changeset
|
290 | icon, |
8318
962bce857696
Replaced all imports of PyQt5 to PyQt6 and started to replace code using obsoleted methods and adapt to the PyQt6 enum usage.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
8312
diff
changeset
|
291 | QMessageBox.StandardButton.Yes | QMessageBox.StandardButton.No, |
9221
bf71ee032bb4
Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9209
diff
changeset
|
292 | yesDefault and QMessageBox.StandardButton.Yes or QMessageBox.StandardButton.No, |
bf71ee032bb4
Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9209
diff
changeset
|
293 | textFormat, |
bf71ee032bb4
Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9209
diff
changeset
|
294 | ) |
8143
2c730d5fd177
Changed the use of PyQt enums because the way they were used previously is deprecated since two years and replaced some deprecated Qt stuff.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
7923
diff
changeset
|
295 | return res == QMessageBox.StandardButton.Yes |
549
fe99d46d56c8
Continued replacing QMessageBox.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
545
diff
changeset
|
296 | |
945
8cd4d08fa9f6
Made code mostly PEP 8 compliant (except all whitespace and line length).
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
791
diff
changeset
|
297 | |
9221
bf71ee032bb4
Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9209
diff
changeset
|
298 | def retryAbort(parent, title, text, icon=Question, textFormat=Qt.TextFormat.AutoText): |
550
22b951013193
Continued replacing QMessageBox.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
549
diff
changeset
|
299 | """ |
22b951013193
Continued replacing QMessageBox.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
549
diff
changeset
|
300 | Function to show a model abort/retry message box. |
9221
bf71ee032bb4
Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9209
diff
changeset
|
301 | |
550
22b951013193
Continued replacing QMessageBox.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
549
diff
changeset
|
302 | @param parent parent widget of the message box (QWidget) |
22b951013193
Continued replacing QMessageBox.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
549
diff
changeset
|
303 | @param title caption of the message box (string) |
22b951013193
Continued replacing QMessageBox.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
549
diff
changeset
|
304 | @param text text to be shown by the message box (string) |
7900
72b88fb20261
Corrected the use of '@keyparam' in the source documentation.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
7780
diff
changeset
|
305 | @param icon icon for the dialog (Critical, Information, Question or |
2990
583beaf0b4b8
Continued to shorten the code lines to max. 79 characters.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
2302
diff
changeset
|
306 | Warning) |
1366
f2e7957924cb
Fixed a security issue using QLabel for showing SSL certificate infos without setting the label's text format to Qt.PlainText.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
1131
diff
changeset
|
307 | @param textFormat format of the text (Qt.TextFormat) |
550
22b951013193
Continued replacing QMessageBox.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
549
diff
changeset
|
308 | @return flag indicating the selection of the Retry button (boolean) |
7628
f904d0eef264
Checked the reported security related issue reports generated by the new security checker.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
7360
diff
changeset
|
309 | @exception ValueError raised to indicate a bad parameter value |
550
22b951013193
Continued replacing QMessageBox.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
549
diff
changeset
|
310 | """ |
7628
f904d0eef264
Checked the reported security related issue reports generated by the new security checker.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
7360
diff
changeset
|
311 | if icon not in [Critical, Information, Question, Warning]: |
f904d0eef264
Checked the reported security related issue reports generated by the new security checker.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
7360
diff
changeset
|
312 | raise ValueError("Bad value for 'icon' parameter.") |
9221
bf71ee032bb4
Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9209
diff
changeset
|
313 | |
3022
57179e4cdadd
Fixed a bunch of visible indentation issues.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
2990
diff
changeset
|
314 | res = __messageBox( |
9221
bf71ee032bb4
Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9209
diff
changeset
|
315 | parent, |
bf71ee032bb4
Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9209
diff
changeset
|
316 | title, |
bf71ee032bb4
Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9209
diff
changeset
|
317 | text, |
bf71ee032bb4
Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9209
diff
changeset
|
318 | icon, |
8318
962bce857696
Replaced all imports of PyQt5 to PyQt6 and started to replace code using obsoleted methods and adapt to the PyQt6 enum usage.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
8312
diff
changeset
|
319 | QMessageBox.StandardButton.Retry | QMessageBox.StandardButton.Abort, |
8143
2c730d5fd177
Changed the use of PyQt enums because the way they were used previously is deprecated since two years and replaced some deprecated Qt stuff.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
7923
diff
changeset
|
320 | QMessageBox.StandardButton.Retry, |
9221
bf71ee032bb4
Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9209
diff
changeset
|
321 | textFormat, |
bf71ee032bb4
Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9209
diff
changeset
|
322 | ) |
8143
2c730d5fd177
Changed the use of PyQt enums because the way they were used previously is deprecated since two years and replaced some deprecated Qt stuff.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
7923
diff
changeset
|
323 | return res == QMessageBox.StandardButton.Retry |
550
22b951013193
Continued replacing QMessageBox.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
549
diff
changeset
|
324 | |
945
8cd4d08fa9f6
Made code mostly PEP 8 compliant (except all whitespace and line length).
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
791
diff
changeset
|
325 | |
9221
bf71ee032bb4
Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9209
diff
changeset
|
326 | def okToClearData(parent, title, text, saveFunc, textFormat=Qt.TextFormat.AutoText): |
549
fe99d46d56c8
Continued replacing QMessageBox.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
545
diff
changeset
|
327 | """ |
9757
ab6e87f6f1c4
Modified the EricMessageBox okToClearData() function for more flexibility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9653
diff
changeset
|
328 | Function to show a modal message box to ask for clearing the data. |
9221
bf71ee032bb4
Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9209
diff
changeset
|
329 | |
549
fe99d46d56c8
Continued replacing QMessageBox.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
545
diff
changeset
|
330 | @param parent parent widget of the message box (QWidget) |
fe99d46d56c8
Continued replacing QMessageBox.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
545
diff
changeset
|
331 | @param title caption of the message box (string) |
fe99d46d56c8
Continued replacing QMessageBox.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
545
diff
changeset
|
332 | @param text text to be shown by the message box (string) |
fe99d46d56c8
Continued replacing QMessageBox.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
545
diff
changeset
|
333 | @param saveFunc reference to a function performing the save action. It |
fe99d46d56c8
Continued replacing QMessageBox.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
545
diff
changeset
|
334 | must be a parameterless function returning a flag indicating success. |
1366
f2e7957924cb
Fixed a security issue using QLabel for showing SSL certificate infos without setting the label's text format to Qt.PlainText.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
1131
diff
changeset
|
335 | @param textFormat format of the text (Qt.TextFormat) |
549
fe99d46d56c8
Continued replacing QMessageBox.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
545
diff
changeset
|
336 | @return flag indicating that it is ok to clear the data (boolean) |
fe99d46d56c8
Continued replacing QMessageBox.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
545
diff
changeset
|
337 | """ |
9757
ab6e87f6f1c4
Modified the EricMessageBox okToClearData() function for more flexibility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9653
diff
changeset
|
338 | buttons = QMessageBox.StandardButton.Abort | QMessageBox.StandardButton.Discard |
ab6e87f6f1c4
Modified the EricMessageBox okToClearData() function for more flexibility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9653
diff
changeset
|
339 | if saveFunc: |
ab6e87f6f1c4
Modified the EricMessageBox okToClearData() function for more flexibility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9653
diff
changeset
|
340 | buttons |= QMessageBox.StandardButton.Save |
3022
57179e4cdadd
Fixed a bunch of visible indentation issues.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
2990
diff
changeset
|
341 | res = __messageBox( |
9221
bf71ee032bb4
Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9209
diff
changeset
|
342 | parent, |
bf71ee032bb4
Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9209
diff
changeset
|
343 | title, |
bf71ee032bb4
Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9209
diff
changeset
|
344 | text, |
bf71ee032bb4
Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9209
diff
changeset
|
345 | QMessageBox.Icon.Warning, |
9757
ab6e87f6f1c4
Modified the EricMessageBox okToClearData() function for more flexibility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9653
diff
changeset
|
346 | buttons, |
8143
2c730d5fd177
Changed the use of PyQt enums because the way they were used previously is deprecated since two years and replaced some deprecated Qt stuff.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
7923
diff
changeset
|
347 | QMessageBox.StandardButton.Save, |
9221
bf71ee032bb4
Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9209
diff
changeset
|
348 | textFormat, |
bf71ee032bb4
Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9209
diff
changeset
|
349 | ) |
8143
2c730d5fd177
Changed the use of PyQt enums because the way they were used previously is deprecated since two years and replaced some deprecated Qt stuff.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
7923
diff
changeset
|
350 | if res == QMessageBox.StandardButton.Abort: |
549
fe99d46d56c8
Continued replacing QMessageBox.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
545
diff
changeset
|
351 | return False |
8143
2c730d5fd177
Changed the use of PyQt enums because the way they were used previously is deprecated since two years and replaced some deprecated Qt stuff.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
7923
diff
changeset
|
352 | if res == QMessageBox.StandardButton.Save: |
549
fe99d46d56c8
Continued replacing QMessageBox.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
545
diff
changeset
|
353 | return saveFunc() |
fe99d46d56c8
Continued replacing QMessageBox.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
545
diff
changeset
|
354 | return True |