90 def messageHandler(msgType, context, message): |
90 def messageHandler(msgType, context, message): |
91 """ |
91 """ |
92 Module function handling messages. |
92 Module function handling messages. |
93 |
93 |
94 @param msgType type of the message (integer, QtMsgType) |
94 @param msgType type of the message (integer, QtMsgType) |
|
95 @param context context information (QMessageLogContext) |
95 @param message message to be shown (bytes) |
96 @param message message to be shown (bytes) |
96 """ |
97 """ |
97 if __msgHandlerDialog: |
98 if __msgHandlerDialog: |
98 try: |
99 try: |
99 if msgType == QtDebugMsg: |
100 if msgType == QtDebugMsg: |
113 message = message.replace("\r\n", "<br/>")\ |
114 message = message.replace("\r\n", "<br/>")\ |
114 .replace("\n", "<br/>")\ |
115 .replace("\n", "<br/>")\ |
115 .replace("\r", "<br/>") |
116 .replace("\r", "<br/>") |
116 msg = "<p><b>{0}</b></p><p>{1}</p><p>File: {2}</p>" \ |
117 msg = "<p><b>{0}</b></p><p>{1}</p><p>File: {2}</p>" \ |
117 "<p>Line: {3}</p><p>Function: {4}</p>".format( |
118 "<p>Line: {3}</p><p>Function: {4}</p>".format( |
118 messageType, Utilities.html_uencode(message), |
119 messageType, Utilities.html_uencode(message), |
119 context.file, context.line, context.function) |
120 context.file, context.line, context.function) |
120 if QThread.currentThread() == qApp.thread(): |
121 if QThread.currentThread() == qApp.thread(): |
121 __msgHandlerDialog.showMessage(msg) |
122 __msgHandlerDialog.showMessage(msg) |
122 else: |
123 else: |
123 QMetaObject.invokeMethod( |
124 QMetaObject.invokeMethod( |
124 __msgHandlerDialog, |
125 __msgHandlerDialog, |