This commit is contained in:
恍兮惚兮 2024-06-22 02:15:56 +08:00
parent 03f3d94df5
commit d24d9d3564
2 changed files with 15 additions and 9 deletions

View File

@ -186,16 +186,9 @@ def createinternalfontsettings(self, forml, group, _type):
def resetgroudswitchcallback(self, group):
clearlayout(self.goodfontsettingsformlayout)
if group == "QWebEngine":
group = "webview"
goodfontgroupswitch = FocusCombo()
if group == "webview":
_btn = QPushButton(_TR("额外的html"))
self.goodfontsettingsformlayout.addRow(_btn)
_btn.clicked.connect(lambda: extrahtml(self))
elif group == "textbrowser":
if group == "textbrowser" or group == "QWebEngine":
self.goodfontsettingsformlayout.addRow(
_TR("可选取模式"),
getsimpleswitch(
@ -204,6 +197,12 @@ def resetgroudswitchcallback(self, group):
callback=lambda x: gobject.baseobject.translation_ui.translate_text.textbrowser.setselectable(),
),
)
if group == "webview" or group == "QWebEngine":
_btn = QPushButton(_TR("额外的html"))
self.goodfontsettingsformlayout.addRow(_btn)
_btn.clicked.connect(lambda: extrahtml(self))
if group == "QWebEngine":
group = "webview"
__form = QFormLayout()
__form.addRow(_TR("字体样式"), goodfontgroupswitch)
self.goodfontsettingsformlayout.addRow(__form)

View File

@ -13,7 +13,11 @@ class TextBrowser(QWidget, dataget):
contentsChanged = pyqtSignal(QSize)
def resizeEvent(self, event: QResizeEvent):
self.webivewwidget.resize(event.size().width(), event.size().height())
self.webivewwidget.resize(event.size())
self.masklabel.resize(event.size())
def setselectable(self):
self.masklabel.setHidden(globalconfig["selectable"])
def __init__(self, parent) -> None:
super().__init__(parent)
@ -24,6 +28,8 @@ class TextBrowser(QWidget, dataget):
# webview2当会执行alert之类的弹窗js时若qt窗口不可视会卡住
self.webivewwidget = WebivewWidget(self)
self.masklabel = QLabel(self.webivewwidget)
self.masklabel.setMouseTracking(True)
self.webivewwidget.navigate(
os.path.abspath(r"LunaTranslator\rendertext\webview.html")
)
@ -33,6 +39,7 @@ class TextBrowser(QWidget, dataget):
self.saveiterclasspointer = {}
self.isfirst = True
self._qweb_query_word()
self.setselectable()
def showEvent(self, e):
if not self.isfirst: