Sun, 30 Jun 2024 17:58:31 +0200
Moved some functions to the EricUtilities package for consistency and adapted the code base accordingly.
2683
ef93fc7332a2
Added a specialized error message handler allowing to filter messages.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
1 | # -*- coding: utf-8 -*- |
ef93fc7332a2
Added a specialized error message handler allowing to filter messages.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
2 | |
10439
21c28b0f9e41
Updated copyright for 2024.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9692
diff
changeset
|
3 | # Copyright (c) 2013 - 2024 Detlev Offenbach <detlev@die-offenbachs.de> |
2683
ef93fc7332a2
Added a specialized error message handler allowing to filter messages.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
4 | # |
ef93fc7332a2
Added a specialized error message handler allowing to filter messages.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
5 | |
ef93fc7332a2
Added a specialized error message handler allowing to filter messages.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
6 | """ |
ef93fc7332a2
Added a specialized error message handler allowing to filter messages.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
7 | Module implementing a specialized error message dialog. |
ef93fc7332a2
Added a specialized error message handler allowing to filter messages.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
8 | """ |
ef93fc7332a2
Added a specialized error message handler allowing to filter messages.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
9 | |
8243
cc717c2ae956
Applied some more code simplifications suggested by the new Simplify checker (Y105: use contextlib.suppress) (batch 2).
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
8221
diff
changeset
|
10 | import contextlib |
cc717c2ae956
Applied some more code simplifications suggested by the new Simplify checker (Y105: use contextlib.suppress) (batch 2).
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
8221
diff
changeset
|
11 | |
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:
8314
diff
changeset
|
12 | from PyQt6.QtCore import ( |
9473
3f23dbf37dbe
Resorted the import statements using isort.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9413
diff
changeset
|
13 | Q_ARG, |
3f23dbf37dbe
Resorted the import statements using isort.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9413
diff
changeset
|
14 | QMetaObject, |
3f23dbf37dbe
Resorted the import statements using isort.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9413
diff
changeset
|
15 | QSettings, |
9221
bf71ee032bb4
Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9209
diff
changeset
|
16 | Qt, |
bf71ee032bb4
Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9209
diff
changeset
|
17 | QThread, |
9473
3f23dbf37dbe
Resorted the import statements using isort.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9413
diff
changeset
|
18 | QtMsgType, |
3f23dbf37dbe
Resorted the import statements using isort.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9413
diff
changeset
|
19 | qInstallMessageHandler, |
7252
c5e3705073eb
Continued to resolve code style issue M841.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
7229
diff
changeset
|
20 | ) |
9473
3f23dbf37dbe
Resorted the import statements using isort.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9413
diff
changeset
|
21 | from PyQt6.QtWidgets import QDialog, QErrorMessage |
2683
ef93fc7332a2
Added a specialized error message handler allowing to filter messages.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
22 | |
10806
2f6df822e3b9
Moved some functions to the EricUtilities package for consistency and adapted the code base accordingly.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
10439
diff
changeset
|
23 | from eric7 import EricUtilities, Globals, Preferences, Utilities |
9473
3f23dbf37dbe
Resorted the import statements using isort.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9413
diff
changeset
|
24 | from eric7.EricWidgets.EricApplication import ericApp |
2683
ef93fc7332a2
Added a specialized error message handler allowing to filter messages.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
25 | |
6391
0b91857640ed
E5ErrorMessage: improved the functionality to be able to cope with error message from threads.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
6048
diff
changeset
|
26 | _msgHandlerDialog = None |
0b91857640ed
E5ErrorMessage: improved the functionality to be able to cope with error message from threads.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
6048
diff
changeset
|
27 | _origMsgHandler = None |
0b91857640ed
E5ErrorMessage: improved the functionality to be able to cope with error message from threads.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
6048
diff
changeset
|
28 | |
0b91857640ed
E5ErrorMessage: improved the functionality to be able to cope with error message from threads.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
6048
diff
changeset
|
29 | _filterSettings = QSettings( |
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
|
30 | QSettings.Format.IniFormat, |
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 | QSettings.Scope.UserScope, |
6391
0b91857640ed
E5ErrorMessage: improved the functionality to be able to cope with error message from threads.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
6048
diff
changeset
|
32 | Globals.settingsNameOrganization, |
9221
bf71ee032bb4
Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9209
diff
changeset
|
33 | "eric7messagefilters", |
bf71ee032bb4
Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9209
diff
changeset
|
34 | ) |
6391
0b91857640ed
E5ErrorMessage: improved the functionality to be able to cope with error message from threads.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
6048
diff
changeset
|
35 | _defaultFilters = [ |
0b91857640ed
E5ErrorMessage: improved the functionality to be able to cope with error message from threads.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
6048
diff
changeset
|
36 | "QFont::", |
0b91857640ed
E5ErrorMessage: improved the functionality to be able to cope with error message from threads.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
6048
diff
changeset
|
37 | "QCocoaMenu::removeMenuItem", |
0b91857640ed
E5ErrorMessage: improved the functionality to be able to cope with error message from threads.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
6048
diff
changeset
|
38 | "QCocoaMenu::insertNative", |
0b91857640ed
E5ErrorMessage: improved the functionality to be able to cope with error message from threads.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
6048
diff
changeset
|
39 | ",type id:", |
0b91857640ed
E5ErrorMessage: improved the functionality to be able to cope with error message from threads.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
6048
diff
changeset
|
40 | "Remote debugging server started successfully", |
0b91857640ed
E5ErrorMessage: improved the functionality to be able to cope with error message from threads.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
6048
diff
changeset
|
41 | "Uncaught SecurityError:", |
0b91857640ed
E5ErrorMessage: improved the functionality to be able to cope with error message from threads.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
6048
diff
changeset
|
42 | "Content Security Policy", |
0b91857640ed
E5ErrorMessage: improved the functionality to be able to cope with error message from threads.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
6048
diff
changeset
|
43 | "QXcbClipboard:", |
0b91857640ed
E5ErrorMessage: improved the functionality to be able to cope with error message from threads.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
6048
diff
changeset
|
44 | "QXcbConnection: XCB error", |
0b91857640ed
E5ErrorMessage: improved the functionality to be able to cope with error message from threads.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
6048
diff
changeset
|
45 | "libpng warning: iCCP:", |
8157
800c09ec0956
E5errorMessage: changed the code logic to always apply a default filter set, which is not editable.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
8143
diff
changeset
|
46 | "Uncaught ReferenceError: $ is not defined", |
9692
a0be29ab700a
Extended the list of ignored (filtered) error messages.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9653
diff
changeset
|
47 | "Refused to execute script from", |
6391
0b91857640ed
E5ErrorMessage: improved the functionality to be able to cope with error message from threads.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
6048
diff
changeset
|
48 | ] |
0b91857640ed
E5ErrorMessage: improved the functionality to be able to cope with error message from threads.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
6048
diff
changeset
|
49 | |
0b91857640ed
E5ErrorMessage: improved the functionality to be able to cope with error message from threads.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
6048
diff
changeset
|
50 | |
0b91857640ed
E5ErrorMessage: improved the functionality to be able to cope with error message from threads.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
6048
diff
changeset
|
51 | def filterMessage(message): |
0b91857640ed
E5ErrorMessage: improved the functionality to be able to cope with error message from threads.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
6048
diff
changeset
|
52 | """ |
0b91857640ed
E5ErrorMessage: improved the functionality to be able to cope with error message from threads.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
6048
diff
changeset
|
53 | Module function to filter messages. |
9221
bf71ee032bb4
Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9209
diff
changeset
|
54 | |
6391
0b91857640ed
E5ErrorMessage: improved the functionality to be able to cope with error message from threads.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
6048
diff
changeset
|
55 | @param message message to be checked |
0b91857640ed
E5ErrorMessage: improved the functionality to be able to cope with error message from threads.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
6048
diff
changeset
|
56 | @type str |
0b91857640ed
E5ErrorMessage: improved the functionality to be able to cope with error message from threads.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
6048
diff
changeset
|
57 | @return flag indicating that the message should be filtered out |
0b91857640ed
E5ErrorMessage: improved the functionality to be able to cope with error message from threads.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
6048
diff
changeset
|
58 | @rtype bool |
0b91857640ed
E5ErrorMessage: improved the functionality to be able to cope with error message from threads.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
6048
diff
changeset
|
59 | """ |
8221
0572a215bd2f
Applied some more code simplifications suggested by the new Simplify checker (Y110, Y111: use any() or all()).
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
8218
diff
changeset
|
60 | return any( |
0572a215bd2f
Applied some more code simplifications suggested by the new Simplify checker (Y110, Y111: use any() or all()).
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
8218
diff
changeset
|
61 | filterStr in message |
10806
2f6df822e3b9
Moved some functions to the EricUtilities package for consistency and adapted the code base accordingly.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
10439
diff
changeset
|
62 | for filterStr in EricUtilities.toList( |
2f6df822e3b9
Moved some functions to the EricUtilities package for consistency and adapted the code base accordingly.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
10439
diff
changeset
|
63 | _filterSettings.value("MessageFilters", []) |
2f6df822e3b9
Moved some functions to the EricUtilities package for consistency and adapted the code base accordingly.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
10439
diff
changeset
|
64 | ) |
9221
bf71ee032bb4
Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9209
diff
changeset
|
65 | + _defaultFilters |
8221
0572a215bd2f
Applied some more code simplifications suggested by the new Simplify checker (Y110, Y111: use any() or all()).
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
8218
diff
changeset
|
66 | ) |
2683
ef93fc7332a2
Added a specialized error message handler allowing to filter messages.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
67 | |
ef93fc7332a2
Added a specialized error message handler allowing to filter messages.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
68 | |
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:
8319
diff
changeset
|
69 | class EricErrorMessage(QErrorMessage): |
2683
ef93fc7332a2
Added a specialized error message handler allowing to filter messages.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
70 | """ |
ef93fc7332a2
Added a specialized error message handler allowing to filter messages.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
71 | Class implementing a specialized error message dialog. |
ef93fc7332a2
Added a specialized error message handler allowing to filter messages.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
72 | """ |
9221
bf71ee032bb4
Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9209
diff
changeset
|
73 | |
2683
ef93fc7332a2
Added a specialized error message handler allowing to filter messages.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
74 | def __init__(self, parent=None): |
ef93fc7332a2
Added a specialized error message handler allowing to filter messages.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
75 | """ |
ef93fc7332a2
Added a specialized error message handler allowing to filter messages.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
76 | Constructor |
9221
bf71ee032bb4
Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9209
diff
changeset
|
77 | |
6391
0b91857640ed
E5ErrorMessage: improved the functionality to be able to cope with error message from threads.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
6048
diff
changeset
|
78 | @param parent reference to the parent widget |
0b91857640ed
E5ErrorMessage: improved the functionality to be able to cope with error message from threads.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
6048
diff
changeset
|
79 | @type QWidget |
2683
ef93fc7332a2
Added a specialized error message handler allowing to filter messages.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
80 | """ |
8218
7c09585bd960
Applied some more code simplifications suggested by the new Simplify checker (super(Foo, self) => super()).
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
8157
diff
changeset
|
81 | super().__init__(parent) |
9221
bf71ee032bb4
Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9209
diff
changeset
|
82 | |
2683
ef93fc7332a2
Added a specialized error message handler allowing to filter messages.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
83 | def showMessage(self, message, msgType=""): |
ef93fc7332a2
Added a specialized error message handler allowing to filter messages.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
84 | """ |
ef93fc7332a2
Added a specialized error message handler allowing to filter messages.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
85 | Public method to show a message. |
9221
bf71ee032bb4
Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9209
diff
changeset
|
86 | |
6391
0b91857640ed
E5ErrorMessage: improved the functionality to be able to cope with error message from threads.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
6048
diff
changeset
|
87 | @param message error message to be shown |
0b91857640ed
E5ErrorMessage: improved the functionality to be able to cope with error message from threads.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
6048
diff
changeset
|
88 | @type str |
0b91857640ed
E5ErrorMessage: improved the functionality to be able to cope with error message from threads.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
6048
diff
changeset
|
89 | @param msgType type of the error message |
0b91857640ed
E5ErrorMessage: improved the functionality to be able to cope with error message from threads.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
6048
diff
changeset
|
90 | @type str |
2683
ef93fc7332a2
Added a specialized error message handler allowing to filter messages.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
91 | """ |
6391
0b91857640ed
E5ErrorMessage: improved the functionality to be able to cope with error message from threads.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
6048
diff
changeset
|
92 | if not filterMessage(message): |
2683
ef93fc7332a2
Added a specialized error message handler allowing to filter messages.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
93 | if msgType: |
8218
7c09585bd960
Applied some more code simplifications suggested by the new Simplify checker (super(Foo, self) => super()).
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
8157
diff
changeset
|
94 | super().showMessage(message, msgType) |
2683
ef93fc7332a2
Added a specialized error message handler allowing to filter messages.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
95 | else: |
8218
7c09585bd960
Applied some more code simplifications suggested by the new Simplify checker (super(Foo, self) => super()).
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
8157
diff
changeset
|
96 | super().showMessage(message) |
9221
bf71ee032bb4
Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9209
diff
changeset
|
97 | |
2697
1cd7fa670b05
Added a dialog to edit the list of unwanted error messages.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
2696
diff
changeset
|
98 | def editMessageFilters(self): |
1cd7fa670b05
Added a dialog to edit the list of unwanted error messages.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
2696
diff
changeset
|
99 | """ |
1cd7fa670b05
Added a dialog to edit the list of unwanted error messages.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
2696
diff
changeset
|
100 | Public method to edit the list of message filters. |
1cd7fa670b05
Added a dialog to edit the list of unwanted error messages.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
2696
diff
changeset
|
101 | """ |
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:
8319
diff
changeset
|
102 | from .EricErrorMessageFilterDialog import EricErrorMessageFilterDialog |
9221
bf71ee032bb4
Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9209
diff
changeset
|
103 | |
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:
8319
diff
changeset
|
104 | dlg = EricErrorMessageFilterDialog( |
10806
2f6df822e3b9
Moved some functions to the EricUtilities package for consistency and adapted the code base accordingly.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
10439
diff
changeset
|
105 | EricUtilities.toList(_filterSettings.value("MessageFilters", [])) |
9221
bf71ee032bb4
Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9209
diff
changeset
|
106 | ) |
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
|
107 | if dlg.exec() == QDialog.DialogCode.Accepted: |
2697
1cd7fa670b05
Added a dialog to edit the list of unwanted error messages.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
2696
diff
changeset
|
108 | filters = dlg.getFilters() |
6391
0b91857640ed
E5ErrorMessage: improved the functionality to be able to cope with error message from threads.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
6048
diff
changeset
|
109 | _filterSettings.setValue("MessageFilters", filters) |
2683
ef93fc7332a2
Added a specialized error message handler allowing to filter messages.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
110 | |
ef93fc7332a2
Added a specialized error message handler allowing to filter messages.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
111 | |
7198
684261ef2165
Removed the Qt4 runtime stuff.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
6942
diff
changeset
|
112 | def messageHandler(msgType, context, message): |
2683
ef93fc7332a2
Added a specialized error message handler allowing to filter messages.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
113 | """ |
ef93fc7332a2
Added a specialized error message handler allowing to filter messages.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
114 | Module function handling messages. |
9221
bf71ee032bb4
Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9209
diff
changeset
|
115 | |
6391
0b91857640ed
E5ErrorMessage: improved the functionality to be able to cope with error message from threads.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
6048
diff
changeset
|
116 | @param msgType type of the message |
0b91857640ed
E5ErrorMessage: improved the functionality to be able to cope with error message from threads.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
6048
diff
changeset
|
117 | @type int, QtMsgType |
7198
684261ef2165
Removed the Qt4 runtime stuff.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
6942
diff
changeset
|
118 | @param context context information |
684261ef2165
Removed the Qt4 runtime stuff.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
6942
diff
changeset
|
119 | @type QMessageLogContext |
684261ef2165
Removed the Qt4 runtime stuff.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
6942
diff
changeset
|
120 | @param message message to be shown |
684261ef2165
Removed the Qt4 runtime stuff.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
6942
diff
changeset
|
121 | @type bytes |
2683
ef93fc7332a2
Added a specialized error message handler allowing to filter messages.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
122 | """ |
6391
0b91857640ed
E5ErrorMessage: improved the functionality to be able to cope with error message from threads.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
6048
diff
changeset
|
123 | if _msgHandlerDialog: |
8319
ea11a3948f40
Continued porting eric to PyQt6.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
8318
diff
changeset
|
124 | if msgType.value < Preferences.getUI("MinimumMessageTypeSeverity"): |
7319
49ea50a9a61e
EditorFilePage: added a button to install the PyMdown extensions.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
7317
diff
changeset
|
125 | # severity is lower than configured |
49ea50a9a61e
EditorFilePage: added a button to install the PyMdown extensions.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
7317
diff
changeset
|
126 | # just ignore the message |
49ea50a9a61e
EditorFilePage: added a button to install the PyMdown extensions.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
7317
diff
changeset
|
127 | return |
9221
bf71ee032bb4
Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9209
diff
changeset
|
128 | |
8243
cc717c2ae956
Applied some more code simplifications suggested by the new Simplify checker (Y105: use contextlib.suppress) (batch 2).
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
8221
diff
changeset
|
129 | with contextlib.suppress(RuntimeError): |
8268
6b8128e0c9d1
Modernized some code.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
8257
diff
changeset
|
130 | if msgType == QtMsgType.QtDebugMsg: |
5840
36f8973c5a8d
Removed the translations from E5ErrorMessage as this causes issues on openSUSE Leap 42.3 (maybe earlier versions as well).
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
5597
diff
changeset
|
131 | messageType = "Debug Message:" |
8268
6b8128e0c9d1
Modernized some code.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
8257
diff
changeset
|
132 | elif msgType == QtMsgType.QtInfoMsg: |
6b8128e0c9d1
Modernized some code.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
8257
diff
changeset
|
133 | messageType = "Info Message:" |
6b8128e0c9d1
Modernized some code.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
8257
diff
changeset
|
134 | elif msgType == QtMsgType.QtWarningMsg: |
5840
36f8973c5a8d
Removed the translations from E5ErrorMessage as this causes issues on openSUSE Leap 42.3 (maybe earlier versions as well).
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
5597
diff
changeset
|
135 | messageType = "Warning:" |
8268
6b8128e0c9d1
Modernized some code.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
8257
diff
changeset
|
136 | elif msgType == QtMsgType.QtCriticalMsg: |
5840
36f8973c5a8d
Removed the translations from E5ErrorMessage as this causes issues on openSUSE Leap 42.3 (maybe earlier versions as well).
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
5597
diff
changeset
|
137 | messageType = "Critical:" |
8268
6b8128e0c9d1
Modernized some code.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
8257
diff
changeset
|
138 | elif msgType == QtMsgType.QtFatalMsg: |
5840
36f8973c5a8d
Removed the translations from E5ErrorMessage as this causes issues on openSUSE Leap 42.3 (maybe earlier versions as well).
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
5597
diff
changeset
|
139 | messageType = "Fatal Error:" |
2696
c25359355787
Fixed another issue in the new error message dialog.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
2695
diff
changeset
|
140 | if isinstance(message, bytes): |
3663
83e22cb3b312
Fixed a little issue in the error message handler.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
3656
diff
changeset
|
141 | message = Utilities.decodeBytes(message) |
6391
0b91857640ed
E5ErrorMessage: improved the functionality to be able to cope with error message from threads.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
6048
diff
changeset
|
142 | if filterMessage(message): |
0b91857640ed
E5ErrorMessage: improved the functionality to be able to cope with error message from threads.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
6048
diff
changeset
|
143 | return |
7252
c5e3705073eb
Continued to resolve code style issue M841.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
7229
diff
changeset
|
144 | message = ( |
c5e3705073eb
Continued to resolve code style issue M841.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
7229
diff
changeset
|
145 | message.replace("\r\n", "<br/>") |
c5e3705073eb
Continued to resolve code style issue M841.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
7229
diff
changeset
|
146 | .replace("\n", "<br/>") |
c5e3705073eb
Continued to resolve code style issue M841.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
7229
diff
changeset
|
147 | .replace("\r", "<br/>") |
c5e3705073eb
Continued to resolve code style issue M841.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
7229
diff
changeset
|
148 | ) |
8257
28146736bbfc
Applied some more code simplifications suggested by the new Simplify checker (Y108: use ternary operator).
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
8243
diff
changeset
|
149 | msg = ( |
28146736bbfc
Applied some more code simplifications suggested by the new Simplify checker (Y108: use ternary operator).
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
8243
diff
changeset
|
150 | ( |
7252
c5e3705073eb
Continued to resolve code style issue M841.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
7229
diff
changeset
|
151 | "<p><b>{0}</b></p><p>{1}</p><p>File: {2}</p>" |
c5e3705073eb
Continued to resolve code style issue M841.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
7229
diff
changeset
|
152 | "<p>Line: {3}</p><p>Function: {4}</p>" |
9221
bf71ee032bb4
Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9209
diff
changeset
|
153 | ).format( |
bf71ee032bb4
Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9209
diff
changeset
|
154 | messageType, |
bf71ee032bb4
Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9209
diff
changeset
|
155 | Utilities.html_uencode(message), |
bf71ee032bb4
Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9209
diff
changeset
|
156 | context.file, |
bf71ee032bb4
Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9209
diff
changeset
|
157 | context.line, |
bf71ee032bb4
Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9209
diff
changeset
|
158 | context.function, |
bf71ee032bb4
Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9209
diff
changeset
|
159 | ) |
bf71ee032bb4
Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9209
diff
changeset
|
160 | if context.file is not None |
bf71ee032bb4
Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9209
diff
changeset
|
161 | else "<p><b>{0}</b></p><p>{1}</p>".format( |
bf71ee032bb4
Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9209
diff
changeset
|
162 | messageType, Utilities.html_uencode(message) |
bf71ee032bb4
Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9209
diff
changeset
|
163 | ) |
8257
28146736bbfc
Applied some more code simplifications suggested by the new Simplify checker (Y108: use ternary operator).
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
8243
diff
changeset
|
164 | ) |
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:
8319
diff
changeset
|
165 | if QThread.currentThread() == ericApp().thread(): |
6391
0b91857640ed
E5ErrorMessage: improved the functionality to be able to cope with error message from threads.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
6048
diff
changeset
|
166 | _msgHandlerDialog.showMessage(msg) |
2695
13c6301cbed3
Fixed an issue in the new error message window.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
2683
diff
changeset
|
167 | else: |
13c6301cbed3
Fixed an issue in the new error message window.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
2683
diff
changeset
|
168 | QMetaObject.invokeMethod( |
6391
0b91857640ed
E5ErrorMessage: improved the functionality to be able to cope with error message from threads.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
6048
diff
changeset
|
169 | _msgHandlerDialog, |
2695
13c6301cbed3
Fixed an issue in the new error message window.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
2683
diff
changeset
|
170 | "showMessage", |
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
|
171 | Qt.ConnectionType.QueuedConnection, |
9221
bf71ee032bb4
Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9209
diff
changeset
|
172 | Q_ARG(str, msg), |
bf71ee032bb4
Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9209
diff
changeset
|
173 | ) |
2695
13c6301cbed3
Fixed an issue in the new error message window.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
2683
diff
changeset
|
174 | return |
6391
0b91857640ed
E5ErrorMessage: improved the functionality to be able to cope with error message from threads.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
6048
diff
changeset
|
175 | elif _origMsgHandler: |
0b91857640ed
E5ErrorMessage: improved the functionality to be able to cope with error message from threads.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
6048
diff
changeset
|
176 | _origMsgHandler(msgType, message) |
2695
13c6301cbed3
Fixed an issue in the new error message window.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
2683
diff
changeset
|
177 | return |
9221
bf71ee032bb4
Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9209
diff
changeset
|
178 | |
8268
6b8128e0c9d1
Modernized some code.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
8257
diff
changeset
|
179 | if msgType == QtMsgType.QtDebugMsg: |
5840
36f8973c5a8d
Removed the translations from E5ErrorMessage as this causes issues on openSUSE Leap 42.3 (maybe earlier versions as well).
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
5597
diff
changeset
|
180 | messageType = "Debug Message" |
8268
6b8128e0c9d1
Modernized some code.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
8257
diff
changeset
|
181 | elif msgType == QtMsgType.QtInfoMsg: |
6b8128e0c9d1
Modernized some code.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
8257
diff
changeset
|
182 | messageType = "Info Message:" |
6b8128e0c9d1
Modernized some code.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
8257
diff
changeset
|
183 | elif msgType == QtMsgType.QtWarningMsg: |
5840
36f8973c5a8d
Removed the translations from E5ErrorMessage as this causes issues on openSUSE Leap 42.3 (maybe earlier versions as well).
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
5597
diff
changeset
|
184 | messageType = "Warning" |
8268
6b8128e0c9d1
Modernized some code.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
8257
diff
changeset
|
185 | elif msgType == QtMsgType.QtCriticalMsg: |
5840
36f8973c5a8d
Removed the translations from E5ErrorMessage as this causes issues on openSUSE Leap 42.3 (maybe earlier versions as well).
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
5597
diff
changeset
|
186 | messageType = "Critical" |
8268
6b8128e0c9d1
Modernized some code.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
8257
diff
changeset
|
187 | elif msgType == QtMsgType.QtFatalMsg: |
5840
36f8973c5a8d
Removed the translations from E5ErrorMessage as this causes issues on openSUSE Leap 42.3 (maybe earlier versions as well).
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
5597
diff
changeset
|
188 | messageType = "Fatal Error" |
2696
c25359355787
Fixed another issue in the new error message dialog.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
2695
diff
changeset
|
189 | if isinstance(message, bytes): |
c25359355787
Fixed another issue in the new error message dialog.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
2695
diff
changeset
|
190 | message = message.decode() |
9221
bf71ee032bb4
Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9209
diff
changeset
|
191 | print( |
bf71ee032bb4
Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9209
diff
changeset
|
192 | "{0}: {1} in {2} at line {3} ({4})".format( |
bf71ee032bb4
Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9209
diff
changeset
|
193 | messageType, message, context.file, context.line, context.function |
bf71ee032bb4
Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9209
diff
changeset
|
194 | ) |
bf71ee032bb4
Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9209
diff
changeset
|
195 | ) |
2683
ef93fc7332a2
Added a specialized error message handler allowing to filter messages.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
196 | |
ef93fc7332a2
Added a specialized error message handler allowing to filter messages.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
197 | |
ef93fc7332a2
Added a specialized error message handler allowing to filter messages.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
198 | def qtHandler(): |
ef93fc7332a2
Added a specialized error message handler allowing to filter messages.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
199 | """ |
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:
8319
diff
changeset
|
200 | Module function to install an EricErrorMessage dialog as the global |
2683
ef93fc7332a2
Added a specialized error message handler allowing to filter messages.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
201 | message handler. |
9221
bf71ee032bb4
Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9209
diff
changeset
|
202 | |
6391
0b91857640ed
E5ErrorMessage: improved the functionality to be able to cope with error message from threads.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
6048
diff
changeset
|
203 | @return reference to the message handler dialog |
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:
8319
diff
changeset
|
204 | @rtype EricErrorMessage |
2683
ef93fc7332a2
Added a specialized error message handler allowing to filter messages.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
205 | """ |
6391
0b91857640ed
E5ErrorMessage: improved the functionality to be able to cope with error message from threads.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
6048
diff
changeset
|
206 | global _msgHandlerDialog, _origMsgHandler |
9221
bf71ee032bb4
Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9209
diff
changeset
|
207 | |
6391
0b91857640ed
E5ErrorMessage: improved the functionality to be able to cope with error message from threads.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
6048
diff
changeset
|
208 | if _msgHandlerDialog is None: |
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:
8319
diff
changeset
|
209 | # Install an EricErrorMessage dialog as the global message handler. |
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:
8319
diff
changeset
|
210 | _msgHandlerDialog = EricErrorMessage() |
6391
0b91857640ed
E5ErrorMessage: improved the functionality to be able to cope with error message from threads.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
6048
diff
changeset
|
211 | _origMsgHandler = qInstallMessageHandler(messageHandler) |
9221
bf71ee032bb4
Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9209
diff
changeset
|
212 | |
6391
0b91857640ed
E5ErrorMessage: improved the functionality to be able to cope with error message from threads.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
6048
diff
changeset
|
213 | return _msgHandlerDialog |
2697
1cd7fa670b05
Added a dialog to edit the list of unwanted error messages.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
2696
diff
changeset
|
214 | |
1cd7fa670b05
Added a dialog to edit the list of unwanted error messages.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
2696
diff
changeset
|
215 | |
1cd7fa670b05
Added a dialog to edit the list of unwanted error messages.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
2696
diff
changeset
|
216 | def editMessageFilters(): |
1cd7fa670b05
Added a dialog to edit the list of unwanted error messages.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
2696
diff
changeset
|
217 | """ |
1cd7fa670b05
Added a dialog to edit the list of unwanted error messages.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
2696
diff
changeset
|
218 | Module function to edit the list of message filters. |
1cd7fa670b05
Added a dialog to edit the list of unwanted error messages.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
2696
diff
changeset
|
219 | """ |
6391
0b91857640ed
E5ErrorMessage: improved the functionality to be able to cope with error message from threads.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
6048
diff
changeset
|
220 | if _msgHandlerDialog: |
0b91857640ed
E5ErrorMessage: improved the functionality to be able to cope with error message from threads.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
6048
diff
changeset
|
221 | _msgHandlerDialog.editMessageFilters() |
2697
1cd7fa670b05
Added a dialog to edit the list of unwanted error messages.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
2696
diff
changeset
|
222 | else: |
5840
36f8973c5a8d
Removed the translations from E5ErrorMessage as this causes issues on openSUSE Leap 42.3 (maybe earlier versions as well).
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
5597
diff
changeset
|
223 | print("No message handler installed.") |
2697
1cd7fa670b05
Added a dialog to edit the list of unwanted error messages.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
2696
diff
changeset
|
224 | |
1cd7fa670b05
Added a dialog to edit the list of unwanted error messages.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
2696
diff
changeset
|
225 | |
1cd7fa670b05
Added a dialog to edit the list of unwanted error messages.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
2696
diff
changeset
|
226 | def messageHandlerInstalled(): |
1cd7fa670b05
Added a dialog to edit the list of unwanted error messages.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
2696
diff
changeset
|
227 | """ |
1cd7fa670b05
Added a dialog to edit the list of unwanted error messages.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
2696
diff
changeset
|
228 | Module function to check, if a message handler was installed. |
9221
bf71ee032bb4
Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9209
diff
changeset
|
229 | |
6391
0b91857640ed
E5ErrorMessage: improved the functionality to be able to cope with error message from threads.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
6048
diff
changeset
|
230 | @return flag indicating an installed message handler |
0b91857640ed
E5ErrorMessage: improved the functionality to be able to cope with error message from threads.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
6048
diff
changeset
|
231 | @rtype bool |
2697
1cd7fa670b05
Added a dialog to edit the list of unwanted error messages.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
2696
diff
changeset
|
232 | """ |
6391
0b91857640ed
E5ErrorMessage: improved the functionality to be able to cope with error message from threads.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
6048
diff
changeset
|
233 | return _msgHandlerDialog is not None |
4566
a2e8f3c420ec
Dealt with the M801 code style checker messages.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
4241
diff
changeset
|
234 | |
9221
bf71ee032bb4
Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9209
diff
changeset
|
235 | |
4566
a2e8f3c420ec
Dealt with the M801 code style checker messages.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
4241
diff
changeset
|
236 | # |
a2e8f3c420ec
Dealt with the M801 code style checker messages.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
4241
diff
changeset
|
237 | # eflag: noqa = M801 |