From 5bec874a7b35e4f7394c57d2eafb0fa2536b71e9 Mon Sep 17 00:00:00 2001 From: evandrocoan Date: Sun, 31 May 2020 15:50:57 -0300 Subject: [PATCH] Set to also print the correct QT log message category --- qt/aqt/__init__.py | 20 ++++++++++++++++++-- 1 file changed, 18 insertions(+), 2 deletions(-) diff --git a/qt/aqt/__init__.py b/qt/aqt/__init__.py index 3f9090f30..145e52e35 100644 --- a/qt/aqt/__init__.py +++ b/qt/aqt/__init__.py @@ -325,7 +325,23 @@ def setupGL(pm): ctypes.CDLL("libGL.so.1", ctypes.RTLD_GLOBAL) # catch opengl errors - def msgHandler(type, ctx, msg): + def msgHandler(category, ctx, msg): + if category == QtDebugMsg: + category = "debug" + elif category == QtInfoMsg: + category = "info" + elif category == QtWarningMsg: + category = "warning" + elif category == QtCriticalMsg: + category = "critical" + elif category == QtDebugMsg: + category = "debug" + elif category == QtFatalMsg: + category = "fatal" + elif category == QtSystemMsg: + category = "system" + else: + category = "unknown" context = "" if ctx.file: context += f"{ctx.file}:" @@ -344,7 +360,7 @@ def setupGL(pm): pm.nextGlMode() return else: - print(f"qt: {msg} {context}") + print(f"Qt {category}: {msg} {context}") qInstallMessageHandler(msgHandler)