From da26dba8e53a7c83e7fad7df49a4044d11b19461 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E6=81=8D=E5=85=AE=E6=83=9A=E5=85=AE?= <101191390+HIllya51@users.noreply.github.com> Date: Fri, 2 Aug 2024 16:53:53 +0800 Subject: [PATCH] example --- .../rendertext/exampleextrahtml.html | 24 ++++++++++++------- .../LunaTranslator/rendertext/webview.py | 9 +++++-- 2 files changed, 22 insertions(+), 11 deletions(-) diff --git a/LunaTranslator/LunaTranslator/rendertext/exampleextrahtml.html b/LunaTranslator/LunaTranslator/rendertext/exampleextrahtml.html index cd63012f..da98a35e 100644 --- a/LunaTranslator/LunaTranslator/rendertext/exampleextrahtml.html +++ b/LunaTranslator/LunaTranslator/rendertext/exampleextrahtml.html @@ -1,8 +1,14 @@ - - +
Hello, welcome to use LunaTranslator
+ \ No newline at end of file diff --git a/LunaTranslator/LunaTranslator/rendertext/webview.py b/LunaTranslator/LunaTranslator/rendertext/webview.py index 4e6d8c21..3d8bc873 100644 --- a/LunaTranslator/LunaTranslator/rendertext/webview.py +++ b/LunaTranslator/LunaTranslator/rendertext/webview.py @@ -113,8 +113,13 @@ class TextBrowser(QWidget, dataget): self.webivewwidget.on_load.connect(self.__loadextra) def __loadextra(self, _): - if os.path.exists("userconfig/extrahtml.html"): - with open("userconfig/extrahtml.html", "r", encoding="utf8") as ff: + for _ in [ + "userconfig/extrahtml.html", + r"LunaTranslator\rendertext\exampleextrahtml.html", + ]: + if not os.path.exists(_): + continue + with open(_, "r", encoding="utf8") as ff: self.set_extra_html(ff.read()) def debugeval(self, js):