mirror of
https://github.com/ankitects/anki.git
synced 2025-09-23 16:26:40 -04:00
Set to also print the correct QT log message category
This commit is contained in:
parent
25ff525cc9
commit
5bec874a7b
1 changed files with 18 additions and 2 deletions
|
@ -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)
|
||||
|
||||
|
|
Loading…
Reference in a new issue