mirror of
https://github.com/HIllya51/LunaTranslator.git
synced 2025-01-13 15:43:53 +08:00
.
This commit is contained in:
parent
5937a7afdd
commit
a4edf162fd
@ -289,3 +289,11 @@ DECLARE_API void html_bind_function(void *web, const wchar_t *name, void (*funct
|
|||||||
auto ww = static_cast<MWebBrowserEx *>(web);
|
auto ww = static_cast<MWebBrowserEx *>(web);
|
||||||
ww->jsobj->bindfunction(name, function);
|
ww->jsobj->bindfunction(name, function);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
DECLARE_API HWND html_get_ie(void *web)
|
||||||
|
{
|
||||||
|
if (!web)
|
||||||
|
return nullptr;
|
||||||
|
auto ww = static_cast<MWebBrowserEx *>(web);
|
||||||
|
return ww->GetIEServerWindow();
|
||||||
|
}
|
||||||
|
@ -1428,7 +1428,7 @@ class mshtmlWidget(abstractwebview):
|
|||||||
self.curr_url = None
|
self.curr_url = None
|
||||||
t = QTimer(self)
|
t = QTimer(self)
|
||||||
t.setInterval(100)
|
t.setInterval(100)
|
||||||
t.timeout.connect(self.__getcurrenturl)
|
t.timeout.connect(self.__getcurrent)
|
||||||
t.timeout.emit()
|
t.timeout.emit()
|
||||||
t.start()
|
t.start()
|
||||||
self.add_menu(0, _TR("复制"), winsharedutils.clipboard_set)
|
self.add_menu(0, _TR("复制"), winsharedutils.clipboard_set)
|
||||||
@ -1449,11 +1449,19 @@ class mshtmlWidget(abstractwebview):
|
|||||||
func(winsharedutils.html_get_select_text(self.browser))
|
func(winsharedutils.html_get_select_text(self.browser))
|
||||||
return windows.WNDPROCTYPE(orig)(hwnd, msg, wp, lp)
|
return windows.WNDPROCTYPE(orig)(hwnd, msg, wp, lp)
|
||||||
|
|
||||||
def __getcurrenturl(self):
|
def __getcurrent(self):
|
||||||
_u = winsharedutils.html_get_current_url(self.browser)
|
_u = winsharedutils.html_get_current_url(self.browser)
|
||||||
if self.curr_url != _u:
|
if self.curr_url != _u:
|
||||||
self.curr_url = _u
|
self.curr_url = _u
|
||||||
self.on_load.emit(_u)
|
self.on_load.emit(_u)
|
||||||
|
if (
|
||||||
|
windows.GetAsyncKeyState(windows.VK_CONTROL)
|
||||||
|
and windows.GetAsyncKeyState(67)
|
||||||
|
and winsharedutils.html_get_ie(self.browser) == windows.GetFocus()
|
||||||
|
):
|
||||||
|
winsharedutils.clipboard_set(
|
||||||
|
winsharedutils.html_get_select_text(self.browser)
|
||||||
|
)
|
||||||
|
|
||||||
def navigate(self, url):
|
def navigate(self, url):
|
||||||
winsharedutils.html_navigate(self.browser, url)
|
winsharedutils.html_navigate(self.browser, url)
|
||||||
|
@ -265,6 +265,8 @@ FindWindow.argtypes = LPCWSTR, LPCWSTR
|
|||||||
FindWindow.restype = HWND
|
FindWindow.restype = HWND
|
||||||
SetFocus = _user32.SetFocus
|
SetFocus = _user32.SetFocus
|
||||||
SetFocus.argtypes = (HWND,)
|
SetFocus.argtypes = (HWND,)
|
||||||
|
GetFocus = _user32.GetFocus
|
||||||
|
GetFocus.restype = HWND
|
||||||
_EnumWindows = _user32.EnumWindows
|
_EnumWindows = _user32.EnumWindows
|
||||||
_EnumWindows.argtypes = WNDENUMPROC, c_void_p
|
_EnumWindows.argtypes = WNDENUMPROC, c_void_p
|
||||||
_ShellExecuteW = _shell32.ShellExecuteW
|
_ShellExecuteW = _shell32.ShellExecuteW
|
||||||
|
@ -139,7 +139,9 @@ html_get_select_text.restype = c_wchar_p
|
|||||||
html_bind_function_FT = CFUNCTYPE(None, POINTER(c_wchar_p), c_int)
|
html_bind_function_FT = CFUNCTYPE(None, POINTER(c_wchar_p), c_int)
|
||||||
html_bind_function = utilsdll.html_bind_function
|
html_bind_function = utilsdll.html_bind_function
|
||||||
html_bind_function.argtypes = c_void_p, c_wchar_p, html_bind_function_FT
|
html_bind_function.argtypes = c_void_p, c_wchar_p, html_bind_function_FT
|
||||||
|
html_get_ie = utilsdll.html_get_ie
|
||||||
|
html_get_ie.argtypes = (c_void_p,)
|
||||||
|
html_get_ie.restype = HWND
|
||||||
|
|
||||||
_GetLnkTargetPath = utilsdll.GetLnkTargetPath
|
_GetLnkTargetPath = utilsdll.GetLnkTargetPath
|
||||||
_GetLnkTargetPath.argtypes = c_wchar_p, c_wchar_p, c_wchar_p, c_wchar_p
|
_GetLnkTargetPath.argtypes = c_wchar_p, c_wchar_p, c_wchar_p, c_wchar_p
|
||||||
|
Loading…
x
Reference in New Issue
Block a user