189 messageType = "Critical" |
190 messageType = "Critical" |
190 elif msgType == QtMsgType.QtFatalMsg: |
191 elif msgType == QtMsgType.QtFatalMsg: |
191 messageType = "Fatal Error" |
192 messageType = "Fatal Error" |
192 if isinstance(message, bytes): |
193 if isinstance(message, bytes): |
193 message = message.decode() |
194 message = message.decode() |
194 print( |
195 output = "{0}: {1} in {2} at line {3} ({4})".format( |
195 "{0}: {1} in {2} at line {3} ({4})".format( |
196 messageType, message, context.file, context.line, context.function |
196 messageType, message, context.file, context.line, context.function |
|
197 ) |
|
198 ) |
197 ) |
|
198 try: |
|
199 print(output) |
|
200 except RuntimeError: |
|
201 # The wrapped redirector object might be gone. Write an error message |
|
202 # to the original stdout channel. |
|
203 # Note: This can happen during shutdown of an applicaton. |
|
204 if sys.__stdout__ is not None: |
|
205 sys.__stdout__.write(output) |
|
206 sys.__stdout__.flush() |
199 |
207 |
200 |
208 |
201 def qtHandler(minSeverity): |
209 def qtHandler(minSeverity): |
202 """ |
210 """ |
203 Module function to install an EricErrorMessage dialog as the global |
211 Module function to install an EricErrorMessage dialog as the global |