diff --git a/cpp/version.cmake b/cpp/version.cmake
index a4033836..43fb4fbb 100644
--- a/cpp/version.cmake
+++ b/cpp/version.cmake
@@ -1,7 +1,7 @@
set(VERSION_MAJOR 6)
set(VERSION_MINOR 14)
-set(VERSION_PATCH 6)
+set(VERSION_PATCH 7)
set(VERSION_REVISION 0)
set(LUNA_VERSION "{${VERSION_MAJOR},${VERSION_MINOR},${VERSION_PATCH},${VERSION_REVISION}}")
add_library(VERSION_DEF ${CMAKE_CURRENT_LIST_DIR}/version_def.cpp)
diff --git a/py/LunaTranslator/cishu/mdict.py b/py/LunaTranslator/cishu/mdict.py
index 200b1a81..2eff414a 100644
--- a/py/LunaTranslator/cishu/mdict.py
+++ b/py/LunaTranslator/cishu/mdict.py
@@ -2,6 +2,7 @@ import math, base64, uuid, gobject
from cishu.cishubase import DictTree
from myutils.config import isascii
+
class FlexBuffer:
def __init__(self):
@@ -2306,7 +2307,7 @@ class mdict(cishubase):
func = url.split(r"://")[0]
if func == "entry":
- return -1, None
+ return 3, "javascript:(function(){{if(mdict_entry_call)mdict_entry_call(`{}`)}})()".format(url.split(r"://")[1])
url1 = url.split(r"://")[1]
url1 = url1.replace("/", "\\")
@@ -2412,7 +2413,7 @@ class mdict(cishubase):
)
return html_content
- def repairtarget(self, index, base, html_content):
+ def repairtarget(self, index, base, html_content: str):
src_pattern = r'src="([^"]+)"'
href_pattern = r'href="([^"]+)"'
@@ -2432,6 +2433,8 @@ class mdict(cishubase):
_type, file_content = file_content
if _type == -1:
continue
+ elif _type == 3:
+ html_content = html_content.replace(url, file_content)
elif _type == 1:
html_content = self.tryparsecss(html_content, url, file_content, divid)
elif _type == 2:
@@ -2610,12 +2613,16 @@ if (content.style.display === 'block') {
lis.append(
r"""
{}
-
""".format(uid,uid,title,extra,res)
+ """.format(
+ uid, uid, title, extra, res
+ )
)
content += r"""
""".format(''.join(lis))
+ """.format(
+ "".join(lis)
+ )
return content
diff --git a/py/LunaTranslator/gui/showword.py b/py/LunaTranslator/gui/showword.py
index 59728aaa..0498384a 100644
--- a/py/LunaTranslator/gui/showword.py
+++ b/py/LunaTranslator/gui/showword.py
@@ -1058,8 +1058,7 @@ class searchwordW(closeashidewindow):
_ = searchwordWx(self.parent())
_.move(_.pos() + QPoint(20, 20))
_.show()
- _.searchtext.setText(word)
- _.__search_by_click_search_btn()
+ _.search_word.emit(word, False)
def _createnewwindowsearch(self, _):
word = self.searchtext.text()
@@ -1166,6 +1165,9 @@ class searchwordW(closeashidewindow):
self.textOutput.on_ZoomFactorChanged.connect(
functools.partial(globalconfig.__setitem__, "ZoomFactor")
)
+ self.textOutput.bind(
+ "mdict_entry_call", lambda word: self.search_word.emit(word, False)
+ )
self.cache_results = {}
self.hiding = True
diff --git a/py/LunaTranslator/gui/usefulwidget.py b/py/LunaTranslator/gui/usefulwidget.py
index f1db522e..d869f107 100644
--- a/py/LunaTranslator/gui/usefulwidget.py
+++ b/py/LunaTranslator/gui/usefulwidget.py
@@ -1557,6 +1557,10 @@ class auto_select_webview(QWidget):
on_load = pyqtSignal(str)
on_ZoomFactorChanged = pyqtSignal(float)
+ def bind(self, funcname, function):
+ self.bindinfo.append((funcname, function))
+ self.internal.bind(funcname, function)
+
def add_menu(self, index, label, callback):
self.addmenuinfo.append((index, label, callback))
self.internal.add_menu(index, label, callback)
@@ -1592,6 +1596,7 @@ class auto_select_webview(QWidget):
def __init__(self, parent, dyna=False) -> None:
super().__init__(parent)
self.addmenuinfo = []
+ self.bindinfo = []
self.setSizePolicy(QSizePolicy.Policy.Expanding, QSizePolicy.Policy.Expanding)
self.internal = None
layout = QHBoxLayout()
@@ -1628,6 +1633,8 @@ class auto_select_webview(QWidget):
self.setHtml(arg)
for _ in self.addmenuinfo:
self.internal.add_menu(*_)
+ for _ in self.bindinfo:
+ self.internal.bind(*_)
def _createwebview(self):
contex = globalconfig["usewebview"]