mirror of
https://github.com/HIllya51/LunaTranslator.git
synced 2024-12-27 15:44:12 +08:00
.
This commit is contained in:
parent
149945a43e
commit
9931fd9c2d
@ -1,7 +1,7 @@
|
|||||||
|
|
||||||
set(VERSION_MAJOR 6)
|
set(VERSION_MAJOR 6)
|
||||||
set(VERSION_MINOR 14)
|
set(VERSION_MINOR 14)
|
||||||
set(VERSION_PATCH 6)
|
set(VERSION_PATCH 7)
|
||||||
set(VERSION_REVISION 0)
|
set(VERSION_REVISION 0)
|
||||||
set(LUNA_VERSION "{${VERSION_MAJOR},${VERSION_MINOR},${VERSION_PATCH},${VERSION_REVISION}}")
|
set(LUNA_VERSION "{${VERSION_MAJOR},${VERSION_MINOR},${VERSION_PATCH},${VERSION_REVISION}}")
|
||||||
add_library(VERSION_DEF ${CMAKE_CURRENT_LIST_DIR}/version_def.cpp)
|
add_library(VERSION_DEF ${CMAKE_CURRENT_LIST_DIR}/version_def.cpp)
|
||||||
|
@ -2,6 +2,7 @@ import math, base64, uuid, gobject
|
|||||||
from cishu.cishubase import DictTree
|
from cishu.cishubase import DictTree
|
||||||
from myutils.config import isascii
|
from myutils.config import isascii
|
||||||
|
|
||||||
|
|
||||||
class FlexBuffer:
|
class FlexBuffer:
|
||||||
|
|
||||||
def __init__(self):
|
def __init__(self):
|
||||||
@ -2306,7 +2307,7 @@ class mdict(cishubase):
|
|||||||
|
|
||||||
func = url.split(r"://")[0]
|
func = url.split(r"://")[0]
|
||||||
if func == "entry":
|
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 = url.split(r"://")[1]
|
||||||
url1 = url1.replace("/", "\\")
|
url1 = url1.replace("/", "\\")
|
||||||
|
|
||||||
@ -2412,7 +2413,7 @@ class mdict(cishubase):
|
|||||||
)
|
)
|
||||||
return html_content
|
return html_content
|
||||||
|
|
||||||
def repairtarget(self, index, base, html_content):
|
def repairtarget(self, index, base, html_content: str):
|
||||||
|
|
||||||
src_pattern = r'src="([^"]+)"'
|
src_pattern = r'src="([^"]+)"'
|
||||||
href_pattern = r'href="([^"]+)"'
|
href_pattern = r'href="([^"]+)"'
|
||||||
@ -2432,6 +2433,8 @@ class mdict(cishubase):
|
|||||||
_type, file_content = file_content
|
_type, file_content = file_content
|
||||||
if _type == -1:
|
if _type == -1:
|
||||||
continue
|
continue
|
||||||
|
elif _type == 3:
|
||||||
|
html_content = html_content.replace(url, file_content)
|
||||||
elif _type == 1:
|
elif _type == 1:
|
||||||
html_content = self.tryparsecss(html_content, url, file_content, divid)
|
html_content = self.tryparsecss(html_content, url, file_content, divid)
|
||||||
elif _type == 2:
|
elif _type == 2:
|
||||||
@ -2610,12 +2613,16 @@ if (content.style.display === 'block') {
|
|||||||
lis.append(
|
lis.append(
|
||||||
r"""<li><div class="collapsible-header" id="{}" onclick="mdict_flowstyle_clickcallback('{}')">{}</div><div class="collapsible-content" style="{}">
|
r"""<li><div class="collapsible-header" id="{}" onclick="mdict_flowstyle_clickcallback('{}')">{}</div><div class="collapsible-content" style="{}">
|
||||||
{}
|
{}
|
||||||
</div></li>""".format(uid,uid,title,extra,res)
|
</div></li>""".format(
|
||||||
|
uid, uid, title, extra, res
|
||||||
|
)
|
||||||
)
|
)
|
||||||
content += r"""
|
content += r"""
|
||||||
<ul class="collapsible-list">
|
<ul class="collapsible-list">
|
||||||
{}
|
{}
|
||||||
</ul>""".format(''.join(lis))
|
</ul>""".format(
|
||||||
|
"".join(lis)
|
||||||
|
)
|
||||||
|
|
||||||
return content
|
return content
|
||||||
|
|
||||||
|
@ -1058,8 +1058,7 @@ class searchwordW(closeashidewindow):
|
|||||||
_ = searchwordWx(self.parent())
|
_ = searchwordWx(self.parent())
|
||||||
_.move(_.pos() + QPoint(20, 20))
|
_.move(_.pos() + QPoint(20, 20))
|
||||||
_.show()
|
_.show()
|
||||||
_.searchtext.setText(word)
|
_.search_word.emit(word, False)
|
||||||
_.__search_by_click_search_btn()
|
|
||||||
|
|
||||||
def _createnewwindowsearch(self, _):
|
def _createnewwindowsearch(self, _):
|
||||||
word = self.searchtext.text()
|
word = self.searchtext.text()
|
||||||
@ -1166,6 +1165,9 @@ class searchwordW(closeashidewindow):
|
|||||||
self.textOutput.on_ZoomFactorChanged.connect(
|
self.textOutput.on_ZoomFactorChanged.connect(
|
||||||
functools.partial(globalconfig.__setitem__, "ZoomFactor")
|
functools.partial(globalconfig.__setitem__, "ZoomFactor")
|
||||||
)
|
)
|
||||||
|
self.textOutput.bind(
|
||||||
|
"mdict_entry_call", lambda word: self.search_word.emit(word, False)
|
||||||
|
)
|
||||||
self.cache_results = {}
|
self.cache_results = {}
|
||||||
self.hiding = True
|
self.hiding = True
|
||||||
|
|
||||||
|
@ -1557,6 +1557,10 @@ class auto_select_webview(QWidget):
|
|||||||
on_load = pyqtSignal(str)
|
on_load = pyqtSignal(str)
|
||||||
on_ZoomFactorChanged = pyqtSignal(float)
|
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):
|
def add_menu(self, index, label, callback):
|
||||||
self.addmenuinfo.append((index, label, callback))
|
self.addmenuinfo.append((index, label, callback))
|
||||||
self.internal.add_menu(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:
|
def __init__(self, parent, dyna=False) -> None:
|
||||||
super().__init__(parent)
|
super().__init__(parent)
|
||||||
self.addmenuinfo = []
|
self.addmenuinfo = []
|
||||||
|
self.bindinfo = []
|
||||||
self.setSizePolicy(QSizePolicy.Policy.Expanding, QSizePolicy.Policy.Expanding)
|
self.setSizePolicy(QSizePolicy.Policy.Expanding, QSizePolicy.Policy.Expanding)
|
||||||
self.internal = None
|
self.internal = None
|
||||||
layout = QHBoxLayout()
|
layout = QHBoxLayout()
|
||||||
@ -1628,6 +1633,8 @@ class auto_select_webview(QWidget):
|
|||||||
self.setHtml(arg)
|
self.setHtml(arg)
|
||||||
for _ in self.addmenuinfo:
|
for _ in self.addmenuinfo:
|
||||||
self.internal.add_menu(*_)
|
self.internal.add_menu(*_)
|
||||||
|
for _ in self.bindinfo:
|
||||||
|
self.internal.bind(*_)
|
||||||
|
|
||||||
def _createwebview(self):
|
def _createwebview(self):
|
||||||
contex = globalconfig["usewebview"]
|
contex = globalconfig["usewebview"]
|
||||||
|
Loading…
x
Reference in New Issue
Block a user