diff --git a/LunaTranslator/LunaTranslator/gui/textbrowser.py b/LunaTranslator/LunaTranslator/gui/textbrowser.py index 9673d503..15bc16c9 100644 --- a/LunaTranslator/LunaTranslator/gui/textbrowser.py +++ b/LunaTranslator/LunaTranslator/gui/textbrowser.py @@ -105,21 +105,15 @@ class Textbrowser: self.toplabel.setMouseTracking(True) self.textbrowser.setStyleSheet( "border-width: 0;\ - border-style: outset;\ - border-top: 0px solid #e8f3f9;\ - color: white;\ - \ - background-color: rgba(%s, %s, %s, %s)" - % (0, 0, 0, 0) + border-style: outset;\ + color: rgba(0, 0, 0, 0);\ + background-color: rgba(0, 0, 0, 0)" ) self.textbrowserback.setStyleSheet( "border-width: 0;\ - border-style: outset;\ - border-top: 0px solid #e8f3f9;\ - color: white;\ - \ - background-color: rgba(%s, %s, %s, %s)" - % (0, 0, 0, 0) + border-style: outset;\ + color: rgba(0, 0, 0, 0);\ + background-color: rgba(0, 0, 0, 0)" ) self.textcursor = self.textbrowser.textCursor() @@ -266,14 +260,7 @@ class Textbrowser: self.movep(0, self.savey) if globalconfig["zitiyangshi"] == 3: - self.textbrowser.show() - self.textbrowserback.show() self.showyinyingtext(color, b1, b2) - self.textbrowser.hide() - self.textbrowserback.hide() - else: - self.textbrowser.show() - self.textbrowserback.show() def getcurrpointer(self): return self.textcursor.position() diff --git a/LunaTranslator/LunaTranslator/gui/translatorUI.py b/LunaTranslator/LunaTranslator/gui/translatorUI.py index 50770a50..c0b29cca 100644 --- a/LunaTranslator/LunaTranslator/gui/translatorUI.py +++ b/LunaTranslator/LunaTranslator/gui/translatorUI.py @@ -8,7 +8,7 @@ from traceback import print_exc from PyQt5.QtCore import Qt, pyqtSignal import qtawesome from PyQt5.QtCore import pyqtSignal, Qt, QSize -from PyQt5.QtGui import QCursor +from PyQt5.QtGui import QCursor, QColor from PyQt5.QtWidgets import QLabel, QPushButton, QSystemTrayIcon import gobject from myutils.wrapper import threader, trypass @@ -219,7 +219,10 @@ class QUnFrameWindow(resizableframeless): elif globalconfig["zitiyangshi"] == 0: self.translate_text.simplecharformat(color) elif globalconfig["zitiyangshi"] == 3: - self.translate_text.simplecharformat(color) + # hide后无法重新计算布局。设置和背景相同的颜色和alpha来模拟hide + c = QColor(globalconfig["backcolor"]) + c.setAlpha(globalconfig["transparent"] * (not self.backtransparent) / 100) + self.translate_text.simplecharformat(c) if iter_context: iter_res_status, iter_context_class = iter_context