Cache webview.py console regex expression and disable multiline

This commit is contained in:
evandrocoan 2020-04-17 03:42:57 -03:00
parent aa562f490c
commit 38fabcef52

View File

@ -15,6 +15,8 @@ from aqt.qt import *
from aqt.theme import theme_manager from aqt.theme import theme_manager
from aqt.utils import openLink from aqt.utils import openLink
serverbaseurl = re.compile(r"^.+:\/\/[^\/]+")
# Page for debug messages # Page for debug messages
########################################################################## ##########################################################################
@ -74,7 +76,7 @@ class AnkiWebPage(QWebEnginePage): # type: ignore
if srcID.startswith("data"): if srcID.startswith("data"):
srcID = "" srcID = ""
else: else:
srcID = re.sub(r"(?mi).+://[^/]+", "", srcID[:80]) srcID = serverbaseurl.sub("", srcID[:80], 1)
if level == QWebEnginePage.InfoMessageLevel: if level == QWebEnginePage.InfoMessageLevel:
level = "info" level = "info"
elif level == QWebEnginePage.WarningMessageLevel: elif level == QWebEnginePage.WarningMessageLevel: