From 56eea42c07469d40ed19db93ef7966877295adce 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: Wed, 19 Jun 2024 08:09:16 +0800 Subject: [PATCH] update --- .../LunaTranslator/gui/usefulwidget.py | 1 + .../LunaTranslator/rendertext/webview.py | 22 ++++++++++++------- plugins/CMakeLists.txt | 4 ++-- 3 files changed, 17 insertions(+), 10 deletions(-) diff --git a/LunaTranslator/LunaTranslator/gui/usefulwidget.py b/LunaTranslator/LunaTranslator/gui/usefulwidget.py index 8d62e454..79229204 100644 --- a/LunaTranslator/LunaTranslator/gui/usefulwidget.py +++ b/LunaTranslator/LunaTranslator/gui/usefulwidget.py @@ -272,6 +272,7 @@ class resizableframeless(saveposwindow): self.height() - self._padding, self.height() + 1, ] + super().resizeEvent(e) def mousePressEvent(self, event: QMouseEvent): # 重写鼠标点击的事件 diff --git a/LunaTranslator/LunaTranslator/rendertext/webview.py b/LunaTranslator/LunaTranslator/rendertext/webview.py index 49fc9636..cf9f4050 100644 --- a/LunaTranslator/LunaTranslator/rendertext/webview.py +++ b/LunaTranslator/LunaTranslator/rendertext/webview.py @@ -77,8 +77,9 @@ class TextBrowser(QWidget, dataget): f""" document.write(``); @@ -139,12 +140,12 @@ class TextBrowser(QWidget, dataget): return __.gen_html(configs, text, fm, fs, bold, atcenter, color) def _webview_append(self, _id, origin, atcenter, text, tag, flags, color): - + text = text.replace("\n", "
").replace("\\", "\\\\") if len(tag): isshowhira, isshow_fenci, isfenciclick = flags fm, fskana, bold = self._getfontinfo_kana() kanacolor = self._getkanacolor() - text = "" + text = "" for word in tag: color1 = self._randomcolor(word, ignorealpha=True) if isshow_fenci and color1: @@ -155,7 +156,14 @@ class TextBrowser(QWidget, dataget): click = f'''onclick="calllunaclickedword('{quote(json.dumps(word))}')"''' else: click = "" - text += f"""
""" + word["orig"] + "
" + if word["orig"] == "\n": + text = text + "

" + continue + text += ( + f"""
""" + + word["orig"].replace("\\", "\\\\") + + "
" + ) if (word["orig"] != word["hira"]) and isshowhira: text += ( f"" @@ -164,13 +172,11 @@ class TextBrowser(QWidget, dataget): ) else: text += "" - - text = f"" + text + "" + text = text + "
" fm, fs, bold = self._getfontinfo(origin) text = self.gen_html(text, fm, fs, bold, atcenter, color) - - self.testeval(f"document.getElementById(`{_id}`).innerHTML+=`{text}`") + self.testeval(f"document.getElementById(`{_id}`).innerHTML=`{text}`") self.internalheighchange() def clear(self): diff --git a/plugins/CMakeLists.txt b/plugins/CMakeLists.txt index 85bbb8ef..875ba862 100644 --- a/plugins/CMakeLists.txt +++ b/plugins/CMakeLists.txt @@ -27,8 +27,8 @@ include(libs/libs.cmake) set(CMAKE_MODULE_PATH ${CMAKE_MODULE_PATH} ${CMAKE_SOURCE_DIR}/version) include(generate_product_version) -set(VERSION_MAJOR 3) -set(VERSION_MINOR 7) +set(VERSION_MAJOR 5) +set(VERSION_MINOR 0) set(VERSION_PATCH 0) add_library(pch pch.cpp)