eric6/E5Gui/E5ErrorMessage.py

changeset 8243
cc717c2ae956
parent 8221
0572a215bd2f
child 8257
28146736bbfc
equal deleted inserted replaced
8242:aa713ac50c0d 8243:cc717c2ae956
4 # 4 #
5 5
6 """ 6 """
7 Module implementing a specialized error message dialog. 7 Module implementing a specialized error message dialog.
8 """ 8 """
9
10 import contextlib
9 11
10 from PyQt5.QtCore import ( 12 from PyQt5.QtCore import (
11 qInstallMessageHandler, QtDebugMsg, QtWarningMsg, QtCriticalMsg, 13 qInstallMessageHandler, QtDebugMsg, QtWarningMsg, QtCriticalMsg,
12 QtFatalMsg, QThread, QMetaObject, Qt, Q_ARG, QSettings 14 QtFatalMsg, QThread, QMetaObject, Qt, Q_ARG, QSettings
13 ) 15 )
116 if msgType < Preferences.getUI("MinimumMessageTypeSeverity"): 118 if msgType < Preferences.getUI("MinimumMessageTypeSeverity"):
117 # severity is lower than configured 119 # severity is lower than configured
118 # just ignore the message 120 # just ignore the message
119 return 121 return
120 122
121 try: 123 with contextlib.suppress(RuntimeError):
122 if msgType == QtDebugMsg: 124 if msgType == QtDebugMsg:
123 messageType = "Debug Message:" 125 messageType = "Debug Message:"
124 elif msgType == QtWarningMsg: 126 elif msgType == QtWarningMsg:
125 messageType = "Warning:" 127 messageType = "Warning:"
126 elif msgType == QtCriticalMsg: 128 elif msgType == QtCriticalMsg:
152 _msgHandlerDialog, 154 _msgHandlerDialog,
153 "showMessage", 155 "showMessage",
154 Qt.ConnectionType.QueuedConnection, 156 Qt.ConnectionType.QueuedConnection,
155 Q_ARG(str, msg)) 157 Q_ARG(str, msg))
156 return 158 return
157 except RuntimeError:
158 pass
159 elif _origMsgHandler: 159 elif _origMsgHandler:
160 _origMsgHandler(msgType, message) 160 _origMsgHandler(msgType, message)
161 return 161 return
162 162
163 if msgType == QtDebugMsg: 163 if msgType == QtDebugMsg:

eric ide

mercurial