E5Gui/E5ErrorMessage.py

changeset 2695
13c6301cbed3
parent 2683
ef93fc7332a2
child 2696
c25359355787
--- a/E5Gui/E5ErrorMessage.py	Sat Jun 01 12:37:19 2013 +0200
+++ b/E5Gui/E5ErrorMessage.py	Sun Jun 02 17:10:24 2013 +0200
@@ -73,36 +73,41 @@
     @param message message to be shown (bytes)
     """
     if __msgHandlerDialog:
-        if msgType == QtDebugMsg:
-            messageType = QCoreApplication.translate("E5ErrorMessage", "Debug Message:")
-        elif msgType == QtWarningMsg:
-            messageType = QCoreApplication.translate("E5ErrorMessage", "Warning:")
-        elif msgType == QtCriticalMsg:
-            messageType = QCoreApplication.translate("E5ErrorMessage", "Critical:")
-        elif msgType == QtFatalMsg:
-            messageType = QCoreApplication.translate("E5ErrorMessage", "Fatal Error:")
-        msg = "<p><b>{0}</b></p><p>{1}</p>".format(
-            messageType, Utilities.html_uencode(message.decode()))
-        if QThread.currentThread() == qApp.thread():
-            __msgHandlerDialog.showMessage(msg)
-        else:
-            QMetaObject.invokeMethod(
-                __msgHandlerDialog,
-                "showMessage",
-                Qt.QueuedConnection,
-                Q_ARG(str, msg))
+        try:
+            if msgType == QtDebugMsg:
+                messageType = QCoreApplication.translate("E5ErrorMessage", "Debug Message:")
+            elif msgType == QtWarningMsg:
+                messageType = QCoreApplication.translate("E5ErrorMessage", "Warning:")
+            elif msgType == QtCriticalMsg:
+                messageType = QCoreApplication.translate("E5ErrorMessage", "Critical:")
+            elif msgType == QtFatalMsg:
+                messageType = QCoreApplication.translate("E5ErrorMessage", "Fatal Error:")
+            msg = "<p><b>{0}</b></p><p>{1}</p>".format(
+                messageType, Utilities.html_uencode(message.decode()))
+            if QThread.currentThread() == qApp.thread():
+                __msgHandlerDialog.showMessage(msg)
+            else:
+                QMetaObject.invokeMethod(
+                    __msgHandlerDialog,
+                    "showMessage",
+                    Qt.QueuedConnection,
+                    Q_ARG(str, msg))
+            return
+        except RuntimeError:
+            pass
     elif __origMsgHandler:
         __origMsgHandler(msgType, message)
-    else:
-        if msgType == QtDebugMsg:
-            messageType = QCoreApplication.translate("E5ErrorMessage", "Debug Message")
-        elif msgType == QtWarningMsg:
-            messageType = QCoreApplication.translate("E5ErrorMessage", "Warning")
-        elif msgType == QtCriticalMsg:
-            messageType = QCoreApplication.translate("E5ErrorMessage", "Critical")
-        elif msgType == QtFatalMsg:
-            messageType = QCoreApplication.translate("E5ErrorMessage", "Fatal Error")
-        print("{0}: {1}".format(messageType, message.decode()))
+        return
+    
+    if msgType == QtDebugMsg:
+        messageType = QCoreApplication.translate("E5ErrorMessage", "Debug Message")
+    elif msgType == QtWarningMsg:
+        messageType = QCoreApplication.translate("E5ErrorMessage", "Warning")
+    elif msgType == QtCriticalMsg:
+        messageType = QCoreApplication.translate("E5ErrorMessage", "Critical")
+    elif msgType == QtFatalMsg:
+        messageType = QCoreApplication.translate("E5ErrorMessage", "Fatal Error")
+    print("{0}: {1}".format(messageType, message.decode()))
 
 
 def qtHandler():

eric ide

mercurial