From de8c104672968a5b92923aef0de110458e63be17 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: Sun, 15 Sep 2024 15:25:57 +0800 Subject: [PATCH] fix --- .../LunaTranslator/rendertext/textbrowser.py | 33 +++++-------------- plugins/CMakeLists.txt | 2 +- 2 files changed, 10 insertions(+), 25 deletions(-) diff --git a/LunaTranslator/LunaTranslator/rendertext/textbrowser.py b/LunaTranslator/LunaTranslator/rendertext/textbrowser.py index 1e3cd17e..7b676fe2 100644 --- a/LunaTranslator/LunaTranslator/rendertext/textbrowser.py +++ b/LunaTranslator/LunaTranslator/rendertext/textbrowser.py @@ -486,37 +486,22 @@ class TextBrowser(QWidget, dataget): if text[i] != "\n": subtext[-1] += text[i] - used = set() collects = [] for i in range(len(subtext)): - finded = -1 - for j in range(len(self.iteryinyinglabelsave[iter_context_class])): - if j in used: - continue - if ( - self.iteryinyinglabelsave[iter_context_class][j].text() - == subtext[i] - ): - finded = j - used.add(j) - break - if finded >= 0: - _ = self.iteryinyinglabelsave[iter_context_class][finded] - _.move(subpos[i].x(), subpos[i].y() + self.labeloffset_y) - _.show() - else: - if i >= len(self.iteryinyinglabelsave[iter_context_class]): - self.iteryinyinglabelsave[iter_context_class].append( - self.currentclass(self.toplabel2) - ) - _ = self.iteryinyinglabelsave[iter_context_class][i] + if i >= len(self.iteryinyinglabelsave[iter_context_class]): + self.iteryinyinglabelsave[iter_context_class].append( + self.currentclass(self.toplabel2) + ) + _ = self.iteryinyinglabelsave[iter_context_class][i] + if _.text() != subtext[i]: _.setColor(color) _.setText(subtext[i]) _.setFont(font) _.adjustSize() - _.move(subpos[i].x(), subpos[i].y() + self.labeloffset_y) - _.show() + _.move(subpos[i].x(), subpos[i].y() + self.labeloffset_y) + _.show() + self.textcursor.setPosition(pos) self.textbrowser.setTextCursor(self.textcursor) tl1 = self.textbrowser.cursorRect(self.textcursor).topLeft() diff --git a/plugins/CMakeLists.txt b/plugins/CMakeLists.txt index bd4b2042..660a429b 100644 --- a/plugins/CMakeLists.txt +++ b/plugins/CMakeLists.txt @@ -29,7 +29,7 @@ include(generate_product_version) set(VERSION_MAJOR 5) set(VERSION_MINOR 35) -set(VERSION_PATCH 7) +set(VERSION_PATCH 8) add_library(pch pch.cpp) target_precompile_headers(pch PUBLIC pch.h)