evandrocoan 2020-05-31 14:40:05 -03:00
parent 9594a3ef9b
commit 25ff525cc9

View file

@ -326,17 +326,25 @@ def setupGL(pm):
# catch opengl errors # catch opengl errors
def msgHandler(type, ctx, msg): def msgHandler(type, ctx, msg):
context = ""
if ctx.file:
context += f"{ctx.file}:"
if ctx.line:
context += f"{ctx.line},"
if ctx.function:
context += f"{ctx.function}"
if context:
context = f"'{context}'"
if "Failed to create OpenGL context" in msg: if "Failed to create OpenGL context" in msg:
QMessageBox.critical( QMessageBox.critical(
None, None,
"Error", "Error",
"Error loading '%s' graphics driver. Please start Anki again to try next driver." f"Error loading '{mode}' graphics driver. Please start Anki again to try next driver. {context}",
% mode,
) )
pm.nextGlMode() pm.nextGlMode()
return return
else: else:
print("qt:", msg) print(f"qt: {msg} {context}")
qInstallMessageHandler(msgHandler) qInstallMessageHandler(msgHandler)