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: |