src/eric7/EricWidgets/EricErrorMessage.py

Fri, 01 Nov 2024 10:34:41 +0100

author
Detlev Offenbach <detlev@die-offenbachs.de>
date
Fri, 01 Nov 2024 10:34:41 +0100
branch
eric7
changeset 11026
53d18eb2062d
parent 11006
a671918232f3
child 11035
e1e1d6e317c7
permissions
-rw-r--r--

Changed the error message handler to ensure correct errors are printed during application shutdown.

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
11026
53d18eb2062d Changed the error message handler to ensure correct errors are printed during application shutdown.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 11006
diff changeset
11 import sys
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
12
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
13 from PyQt6.QtCore import (
9473
3f23dbf37dbe Resorted the import statements using isort.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 9413
diff changeset
14 Q_ARG,
3f23dbf37dbe Resorted the import statements using isort.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 9413
diff changeset
15 QMetaObject,
3f23dbf37dbe Resorted the import statements using isort.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 9413
diff changeset
16 QSettings,
9221
bf71ee032bb4 Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 9209
diff changeset
17 Qt,
bf71ee032bb4 Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 9209
diff changeset
18 QThread,
9473
3f23dbf37dbe Resorted the import statements using isort.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 9413
diff changeset
19 QtMsgType,
3f23dbf37dbe Resorted the import statements using isort.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 9413
diff changeset
20 qInstallMessageHandler,
7252
c5e3705073eb Continued to resolve code style issue M841.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7229
diff changeset
21 )
9473
3f23dbf37dbe Resorted the import statements using isort.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 9413
diff changeset
22 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
23
10933
95a15b70f7bb Refactored some packages, modules and code to allow extracting the 'EricXxx' packages into a library project.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 10928
diff changeset
24 from eric7 import EricUtilities
95a15b70f7bb Refactored some packages, modules and code to allow extracting the 'EricXxx' packages into a library project.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 10928
diff changeset
25 from eric7.EricCore import EricPreferences
9473
3f23dbf37dbe Resorted the import statements using isort.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 9413
diff changeset
26 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
27
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
28 _msgHandlerDialog = None
10933
95a15b70f7bb Refactored some packages, modules and code to allow extracting the 'EricXxx' packages into a library project.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 10928
diff changeset
29 _msgHandlerMinSeverity = None
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
30 _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
31
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 _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
33 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
34 QSettings.Scope.UserScope,
10933
95a15b70f7bb Refactored some packages, modules and code to allow extracting the 'EricXxx' packages into a library project.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 10928
diff changeset
35 EricPreferences.settingsNameOrganization,
9221
bf71ee032bb4 Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 9209
diff changeset
36 "eric7messagefilters",
bf71ee032bb4 Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 9209
diff changeset
37 )
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
38 _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
39 "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
40 "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
41 "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
42 ",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
43 "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
44 "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
45 "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
46 "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
47 "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
48 "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
49 "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
50 "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
51 ]
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
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
54 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
55 """
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 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
57
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
58 @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
59 @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
60 @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
61 @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
62 """
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
63 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
64 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
65 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
66 _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
67 )
9221
bf71ee032bb4 Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 9209
diff changeset
68 + _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
69 )
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
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
72 class EricErrorMessage(QErrorMessage):
2683
ef93fc7332a2 Added a specialized error message handler allowing to filter messages.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
73 """
ef93fc7332a2 Added a specialized error message handler allowing to filter messages.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
74 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
75 """
9221
bf71ee032bb4 Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 9209
diff changeset
76
2683
ef93fc7332a2 Added a specialized error message handler allowing to filter messages.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
77 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
78 """
ef93fc7332a2 Added a specialized error message handler allowing to filter messages.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
79 Constructor
9221
bf71ee032bb4 Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 9209
diff changeset
80
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
81 @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
82 @type QWidget
2683
ef93fc7332a2 Added a specialized error message handler allowing to filter messages.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
83 """
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
84 super().__init__(parent)
9221
bf71ee032bb4 Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 9209
diff changeset
85
2683
ef93fc7332a2 Added a specialized error message handler allowing to filter messages.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
86 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
87 """
ef93fc7332a2 Added a specialized error message handler allowing to filter messages.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
88 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
89
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
90 @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
91 @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
92 @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
93 @type str
2683
ef93fc7332a2 Added a specialized error message handler allowing to filter messages.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
94 """
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
95 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
96 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
97 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
98 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
99 super().showMessage(message)
9221
bf71ee032bb4 Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 9209
diff changeset
100
2697
1cd7fa670b05 Added a dialog to edit the list of unwanted error messages.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 2696
diff changeset
101 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
102 """
1cd7fa670b05 Added a dialog to edit the list of unwanted error messages.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 2696
diff changeset
103 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
104 """
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
105 from .EricErrorMessageFilterDialog import EricErrorMessageFilterDialog
9221
bf71ee032bb4 Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 9209
diff changeset
106
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
107 dlg = EricErrorMessageFilterDialog(
11006
a671918232f3 Modified modal dialog usage to always include a valid parent (needed for Wayland).
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 10933
diff changeset
108 EricUtilities.toList(_filterSettings.value("MessageFilters", [])),
a671918232f3 Modified modal dialog usage to always include a valid parent (needed for Wayland).
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 10933
diff changeset
109 parent=self,
9221
bf71ee032bb4 Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 9209
diff changeset
110 )
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
111 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
112 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
113 _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
114
ef93fc7332a2 Added a specialized error message handler allowing to filter messages.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
115
7198
684261ef2165 Removed the Qt4 runtime stuff.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 6942
diff changeset
116 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
117 """
ef93fc7332a2 Added a specialized error message handler allowing to filter messages.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
118 Module function handling messages.
9221
bf71ee032bb4 Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 9209
diff changeset
119
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
120 @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
121 @type int, QtMsgType
7198
684261ef2165 Removed the Qt4 runtime stuff.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 6942
diff changeset
122 @param context context information
684261ef2165 Removed the Qt4 runtime stuff.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 6942
diff changeset
123 @type QMessageLogContext
684261ef2165 Removed the Qt4 runtime stuff.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 6942
diff changeset
124 @param message message to be shown
684261ef2165 Removed the Qt4 runtime stuff.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 6942
diff changeset
125 @type bytes
2683
ef93fc7332a2 Added a specialized error message handler allowing to filter messages.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
126 """
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
127 if _msgHandlerDialog:
10933
95a15b70f7bb Refactored some packages, modules and code to allow extracting the 'EricXxx' packages into a library project.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 10928
diff changeset
128 if msgType.value < _msgHandlerMinSeverity:
7319
49ea50a9a61e EditorFilePage: added a button to install the PyMdown extensions.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7317
diff changeset
129 # 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
130 # just ignore the message
49ea50a9a61e EditorFilePage: added a button to install the PyMdown extensions.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7317
diff changeset
131 return
9221
bf71ee032bb4 Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 9209
diff changeset
132
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
133 with contextlib.suppress(RuntimeError):
8268
6b8128e0c9d1 Modernized some code.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 8257
diff changeset
134 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
135 messageType = "Debug Message:"
8268
6b8128e0c9d1 Modernized some code.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 8257
diff changeset
136 elif msgType == QtMsgType.QtInfoMsg:
6b8128e0c9d1 Modernized some code.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 8257
diff changeset
137 messageType = "Info Message:"
6b8128e0c9d1 Modernized some code.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 8257
diff changeset
138 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
139 messageType = "Warning:"
8268
6b8128e0c9d1 Modernized some code.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 8257
diff changeset
140 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
141 messageType = "Critical:"
8268
6b8128e0c9d1 Modernized some code.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 8257
diff changeset
142 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
143 messageType = "Fatal Error:"
2696
c25359355787 Fixed another issue in the new error message dialog.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 2695
diff changeset
144 if isinstance(message, bytes):
10933
95a15b70f7bb Refactored some packages, modules and code to allow extracting the 'EricXxx' packages into a library project.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 10928
diff changeset
145 message = EricUtilities.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
146 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
147 return
7252
c5e3705073eb Continued to resolve code style issue M841.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7229
diff changeset
148 message = (
c5e3705073eb Continued to resolve code style issue M841.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7229
diff changeset
149 message.replace("\r\n", "<br/>")
c5e3705073eb Continued to resolve code style issue M841.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7229
diff changeset
150 .replace("\n", "<br/>")
c5e3705073eb Continued to resolve code style issue M841.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7229
diff changeset
151 .replace("\r", "<br/>")
c5e3705073eb Continued to resolve code style issue M841.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7229
diff changeset
152 )
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
153 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
154 (
7252
c5e3705073eb Continued to resolve code style issue M841.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7229
diff changeset
155 "<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
156 "<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
157 ).format(
bf71ee032bb4 Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 9209
diff changeset
158 messageType,
10928
46651e194fbe Refactored some packages, modules and code to allow extracting the 'EricXxx' packages into a library project.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 10806
diff changeset
159 EricUtilities.html_uencode(message),
9221
bf71ee032bb4 Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 9209
diff changeset
160 context.file,
bf71ee032bb4 Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 9209
diff changeset
161 context.line,
bf71ee032bb4 Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 9209
diff changeset
162 context.function,
bf71ee032bb4 Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 9209
diff changeset
163 )
bf71ee032bb4 Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 9209
diff changeset
164 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
165 else "<p><b>{0}</b></p><p>{1}</p>".format(
10928
46651e194fbe Refactored some packages, modules and code to allow extracting the 'EricXxx' packages into a library project.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 10806
diff changeset
166 messageType, EricUtilities.html_uencode(message)
9221
bf71ee032bb4 Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 9209
diff changeset
167 )
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
168 )
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
169 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
170 _msgHandlerDialog.showMessage(msg)
2695
13c6301cbed3 Fixed an issue in the new error message window.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 2683
diff changeset
171 else:
13c6301cbed3 Fixed an issue in the new error message window.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 2683
diff changeset
172 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
173 _msgHandlerDialog,
2695
13c6301cbed3 Fixed an issue in the new error message window.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 2683
diff changeset
174 "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
175 Qt.ConnectionType.QueuedConnection,
9221
bf71ee032bb4 Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 9209
diff changeset
176 Q_ARG(str, msg),
bf71ee032bb4 Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 9209
diff changeset
177 )
2695
13c6301cbed3 Fixed an issue in the new error message window.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 2683
diff changeset
178 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
179 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
180 _origMsgHandler(msgType, message)
2695
13c6301cbed3 Fixed an issue in the new error message window.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 2683
diff changeset
181 return
9221
bf71ee032bb4 Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 9209
diff changeset
182
8268
6b8128e0c9d1 Modernized some code.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 8257
diff changeset
183 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
184 messageType = "Debug Message"
8268
6b8128e0c9d1 Modernized some code.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 8257
diff changeset
185 elif msgType == QtMsgType.QtInfoMsg:
6b8128e0c9d1 Modernized some code.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 8257
diff changeset
186 messageType = "Info Message:"
6b8128e0c9d1 Modernized some code.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 8257
diff changeset
187 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
188 messageType = "Warning"
8268
6b8128e0c9d1 Modernized some code.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 8257
diff changeset
189 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
190 messageType = "Critical"
8268
6b8128e0c9d1 Modernized some code.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 8257
diff changeset
191 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
192 messageType = "Fatal Error"
2696
c25359355787 Fixed another issue in the new error message dialog.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 2695
diff changeset
193 if isinstance(message, bytes):
c25359355787 Fixed another issue in the new error message dialog.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 2695
diff changeset
194 message = message.decode()
11026
53d18eb2062d Changed the error message handler to ensure correct errors are printed during application shutdown.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 11006
diff changeset
195 output = "{0}: {1} in {2} at line {3} ({4})".format(
53d18eb2062d Changed the error message handler to ensure correct errors are printed during application shutdown.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 11006
diff changeset
196 messageType, message, context.file, context.line, context.function
9221
bf71ee032bb4 Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 9209
diff changeset
197 )
11026
53d18eb2062d Changed the error message handler to ensure correct errors are printed during application shutdown.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 11006
diff changeset
198 try:
53d18eb2062d Changed the error message handler to ensure correct errors are printed during application shutdown.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 11006
diff changeset
199 print(output)
53d18eb2062d Changed the error message handler to ensure correct errors are printed during application shutdown.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 11006
diff changeset
200 except RuntimeError:
53d18eb2062d Changed the error message handler to ensure correct errors are printed during application shutdown.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 11006
diff changeset
201 # The wrapped redirector object might be gone. Write an error message
53d18eb2062d Changed the error message handler to ensure correct errors are printed during application shutdown.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 11006
diff changeset
202 # to the original stdout channel.
53d18eb2062d Changed the error message handler to ensure correct errors are printed during application shutdown.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 11006
diff changeset
203 # Note: This can happen during shutdown of an applicaton.
53d18eb2062d Changed the error message handler to ensure correct errors are printed during application shutdown.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 11006
diff changeset
204 if sys.__stdout__ is not None:
53d18eb2062d Changed the error message handler to ensure correct errors are printed during application shutdown.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 11006
diff changeset
205 sys.__stdout__.write(output)
53d18eb2062d Changed the error message handler to ensure correct errors are printed during application shutdown.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 11006
diff changeset
206 sys.__stdout__.flush()
2683
ef93fc7332a2 Added a specialized error message handler allowing to filter messages.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
207
ef93fc7332a2 Added a specialized error message handler allowing to filter messages.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
208
10933
95a15b70f7bb Refactored some packages, modules and code to allow extracting the 'EricXxx' packages into a library project.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 10928
diff changeset
209 def qtHandler(minSeverity):
2683
ef93fc7332a2 Added a specialized error message handler allowing to filter messages.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
210 """
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
211 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
212 message handler.
9221
bf71ee032bb4 Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 9209
diff changeset
213
10933
95a15b70f7bb Refactored some packages, modules and code to allow extracting the 'EricXxx' packages into a library project.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 10928
diff changeset
214 @param minSeverity minimum severity of messages to be shown
95a15b70f7bb Refactored some packages, modules and code to allow extracting the 'EricXxx' packages into a library project.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 10928
diff changeset
215 @type int
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
216 @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
217 @rtype EricErrorMessage
2683
ef93fc7332a2 Added a specialized error message handler allowing to filter messages.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
218 """
10933
95a15b70f7bb Refactored some packages, modules and code to allow extracting the 'EricXxx' packages into a library project.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 10928
diff changeset
219 global _msgHandlerDialog, _msgHandlerMinSeverity, _origMsgHandler
9221
bf71ee032bb4 Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 9209
diff changeset
220
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
221 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
222 # 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
223 _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
224 _origMsgHandler = qInstallMessageHandler(messageHandler)
9221
bf71ee032bb4 Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 9209
diff changeset
225
10933
95a15b70f7bb Refactored some packages, modules and code to allow extracting the 'EricXxx' packages into a library project.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 10928
diff changeset
226 _msgHandlerMinSeverity = minSeverity
95a15b70f7bb Refactored some packages, modules and code to allow extracting the 'EricXxx' packages into a library project.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 10928
diff changeset
227
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
228 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
229
1cd7fa670b05 Added a dialog to edit the list of unwanted error messages.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 2696
diff changeset
230
1cd7fa670b05 Added a dialog to edit the list of unwanted error messages.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 2696
diff changeset
231 def editMessageFilters():
1cd7fa670b05 Added a dialog to edit the list of unwanted error messages.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 2696
diff changeset
232 """
1cd7fa670b05 Added a dialog to edit the list of unwanted error messages.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 2696
diff changeset
233 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
234 """
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
235 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
236 _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
237 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
238 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
239
1cd7fa670b05 Added a dialog to edit the list of unwanted error messages.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 2696
diff changeset
240
1cd7fa670b05 Added a dialog to edit the list of unwanted error messages.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 2696
diff changeset
241 def messageHandlerInstalled():
1cd7fa670b05 Added a dialog to edit the list of unwanted error messages.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 2696
diff changeset
242 """
1cd7fa670b05 Added a dialog to edit the list of unwanted error messages.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 2696
diff changeset
243 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
244
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
245 @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
246 @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
247 """
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
248 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
249
9221
bf71ee032bb4 Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 9209
diff changeset
250
4566
a2e8f3c420ec Dealt with the M801 code style checker messages.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 4241
diff changeset
251 #
a2e8f3c420ec Dealt with the M801 code style checker messages.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 4241
diff changeset
252 # eflag: noqa = M801

eric ide

mercurial