From 38fabcef52c0c5fe52d8d82e2dac332a51aaa23c Mon Sep 17 00:00:00 2001 From: evandrocoan Date: Fri, 17 Apr 2020 03:42:57 -0300 Subject: [PATCH] Cache webview.py console regex expression and disable multiline --- qt/aqt/webview.py | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/qt/aqt/webview.py b/qt/aqt/webview.py index 0196df875..1e1da0ede 100644 --- a/qt/aqt/webview.py +++ b/qt/aqt/webview.py @@ -15,6 +15,8 @@ from aqt.qt import * from aqt.theme import theme_manager from aqt.utils import openLink +serverbaseurl = re.compile(r"^.+:\/\/[^\/]+") + # Page for debug messages ########################################################################## @@ -74,7 +76,7 @@ class AnkiWebPage(QWebEnginePage): # type: ignore if srcID.startswith("data"): srcID = "" else: - srcID = re.sub(r"(?mi).+://[^/]+", "", srcID[:80]) + srcID = serverbaseurl.sub("", srcID[:80], 1) if level == QWebEnginePage.InfoMessageLevel: level = "info" elif level == QWebEnginePage.WarningMessageLevel: