mirror of
https://github.com/HIllya51/LunaTranslator.git
synced 2025-01-01 10:04:12 +08:00
select
This commit is contained in:
parent
03f3d94df5
commit
d24d9d3564
@ -186,16 +186,9 @@ def createinternalfontsettings(self, forml, group, _type):
|
|||||||
def resetgroudswitchcallback(self, group):
|
def resetgroudswitchcallback(self, group):
|
||||||
clearlayout(self.goodfontsettingsformlayout)
|
clearlayout(self.goodfontsettingsformlayout)
|
||||||
|
|
||||||
if group == "QWebEngine":
|
|
||||||
group = "webview"
|
|
||||||
|
|
||||||
goodfontgroupswitch = FocusCombo()
|
goodfontgroupswitch = FocusCombo()
|
||||||
|
|
||||||
if group == "webview":
|
if group == "textbrowser" or group == "QWebEngine":
|
||||||
_btn = QPushButton(_TR("额外的html"))
|
|
||||||
self.goodfontsettingsformlayout.addRow(_btn)
|
|
||||||
_btn.clicked.connect(lambda: extrahtml(self))
|
|
||||||
elif group == "textbrowser":
|
|
||||||
self.goodfontsettingsformlayout.addRow(
|
self.goodfontsettingsformlayout.addRow(
|
||||||
_TR("可选取模式"),
|
_TR("可选取模式"),
|
||||||
getsimpleswitch(
|
getsimpleswitch(
|
||||||
@ -204,6 +197,12 @@ def resetgroudswitchcallback(self, group):
|
|||||||
callback=lambda x: gobject.baseobject.translation_ui.translate_text.textbrowser.setselectable(),
|
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 = QFormLayout()
|
||||||
__form.addRow(_TR("字体样式"), goodfontgroupswitch)
|
__form.addRow(_TR("字体样式"), goodfontgroupswitch)
|
||||||
self.goodfontsettingsformlayout.addRow(__form)
|
self.goodfontsettingsformlayout.addRow(__form)
|
||||||
|
@ -13,7 +13,11 @@ class TextBrowser(QWidget, dataget):
|
|||||||
contentsChanged = pyqtSignal(QSize)
|
contentsChanged = pyqtSignal(QSize)
|
||||||
|
|
||||||
def resizeEvent(self, event: QResizeEvent):
|
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:
|
def __init__(self, parent) -> None:
|
||||||
super().__init__(parent)
|
super().__init__(parent)
|
||||||
@ -24,6 +28,8 @@ class TextBrowser(QWidget, dataget):
|
|||||||
# webview2当会执行alert之类的弹窗js时,若qt窗口不可视,会卡住
|
# webview2当会执行alert之类的弹窗js时,若qt窗口不可视,会卡住
|
||||||
self.webivewwidget = WebivewWidget(self)
|
self.webivewwidget = WebivewWidget(self)
|
||||||
|
|
||||||
|
self.masklabel = QLabel(self.webivewwidget)
|
||||||
|
self.masklabel.setMouseTracking(True)
|
||||||
self.webivewwidget.navigate(
|
self.webivewwidget.navigate(
|
||||||
os.path.abspath(r"LunaTranslator\rendertext\webview.html")
|
os.path.abspath(r"LunaTranslator\rendertext\webview.html")
|
||||||
)
|
)
|
||||||
@ -33,6 +39,7 @@ class TextBrowser(QWidget, dataget):
|
|||||||
self.saveiterclasspointer = {}
|
self.saveiterclasspointer = {}
|
||||||
self.isfirst = True
|
self.isfirst = True
|
||||||
self._qweb_query_word()
|
self._qweb_query_word()
|
||||||
|
self.setselectable()
|
||||||
|
|
||||||
def showEvent(self, e):
|
def showEvent(self, e):
|
||||||
if not self.isfirst:
|
if not self.isfirst:
|
||||||
|
Loading…
x
Reference in New Issue
Block a user