Skip to content

Commit

Permalink
fix
Browse files Browse the repository at this point in the history
  • Loading branch information
HIllya51 committed May 3, 2024
1 parent 44a0a12 commit b89065f
Show file tree
Hide file tree
Showing 3 changed files with 17 additions and 10 deletions.
23 changes: 14 additions & 9 deletions LunaTranslator/LunaTranslator/gui/textbrowser.py
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,12 @@
QColor,
QFontMetricsF,
)
from PyQt5.QtWidgets import QTextBrowser, QLabel, QGraphicsDropShadowEffect
from PyQt5.QtWidgets import (
QTextBrowser,
QLabel,
QGraphicsDropShadowEffect,
QApplication,
)
import functools
from myutils.config import globalconfig
from traceback import print_exc
Expand Down Expand Up @@ -225,8 +230,12 @@ def setAlignment(self, x):
else:
self.align = False

def append(self, x, tag, origin):
def showhide(self):
self.textbrowserback.setVisible(globalconfig["zitiyangshi"] != 3)
self.textbrowser.setVisible(globalconfig["zitiyangshi"] != 3)
QApplication.processEvents()

def append(self, x, tag, origin):
if self.cleared:
_space = ""
self.blockcount = 0
Expand Down Expand Up @@ -393,13 +402,9 @@ def showyinyingtext(self, color):

index = linei
_ = self.yinyinglabels[index]
if self.align:
_.setAlignment(Qt.AlignCenter)
_.move(0,tl1.y())
_.setFixedWidth(self.textbrowser.width())
else:
_.setAlignment(Qt.AlignLeft)
_.move(tl1)

_.setAlignment(Qt.AlignLeft)
_.move(tl1)
_.setText(block.text()[s : s + l])
_.setFont(self.textbrowser.currentCharFormat().font())

Expand Down
2 changes: 2 additions & 0 deletions LunaTranslator/LunaTranslator/gui/translatorUI.py
Original file line number Diff line number Diff line change
Expand Up @@ -258,6 +258,7 @@ def showline(self, **kwargs): # clear,res,color ,type_=1,origin=True):
self.saveiterclasspointer[klass]["curr"] += currchange
self.saveiterclasspointer[klass]["start"] += currchange

self.translate_text.showhide()
if globalconfig["zitiyangshi"] == 3:
self.translate_text.showyinyingtext2(
color,
Expand All @@ -270,6 +271,7 @@ def showline(self, **kwargs): # clear,res,color ,type_=1,origin=True):
self.translate_text.append(
text, hira if globalconfig["isshowhira"] else [], origin
)
self.translate_text.showhide()
if globalconfig["zitiyangshi"] == 3:
self.translate_text.showyinyingtext(color)

Expand Down
2 changes: 1 addition & 1 deletion plugins/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ include(generate_product_version)

set(VERSION_MAJOR 2)
set(VERSION_MINOR 48)
set(VERSION_PATCH 0)
set(VERSION_PATCH 1)

add_library(pch pch.cpp)
target_precompile_headers(pch PUBLIC pch.h)
Expand Down

0 comments on commit b89065f

Please sign in to comment.