issues/645

This commit is contained in:
恍兮惚兮 2024-04-11 23:29:16 +08:00
parent 7841368a1f
commit a41ae5252d
3 changed files with 16 additions and 9 deletions

View File

@ -46,6 +46,7 @@ def setTab_quick_direct(self):
windows.RegisterWindowMessage("Magpie_Core_CLI_Message_ToggleOverlay"),
),
"_26": gobject.baseobject.translation_ui.ocr_once_signal.emit,
"_27": gobject.baseobject.translation_ui.simulate_key_enter,
}
for name in globalconfig["quick_setting"]["all"]:
if name not in self.bindfunctions:

View File

@ -390,15 +390,16 @@ class QUnFrameWindow(resizableframeless):
rangeselct_function(self, ocroncefunction, False, False)
def addbuttons(self):
def simulate_key_enter():
windows.SetForegroundWindow(gobject.baseobject.textsource.hwnd)
time.sleep(0.1)
while windows.GetForegroundWindow() == gobject.baseobject.textsource.hwnd:
time.sleep(0.001)
windows.keybd_event(13, 0, 0, 0)
windows.keybd_event(13, 0, windows.KEYEVENTF_KEYUP, 0)
@threader
def simulate_key_enter(self):
windows.SetForegroundWindow(gobject.baseobject.textsource.hwnd)
time.sleep(0.1)
while windows.GetForegroundWindow() == gobject.baseobject.textsource.hwnd:
time.sleep(0.001)
windows.keybd_event(13, 0, 0, 0)
windows.keybd_event(13, 0, windows.KEYEVENTF_KEYUP, 0)
def addbuttons(self):
def simulate_key_ctrl():
windows.SetForegroundWindow(gobject.baseobject.textsource.hwnd)
time.sleep(0.1)
@ -469,7 +470,7 @@ class QUnFrameWindow(resizableframeless):
),
(
"simulate_key_enter",
lambda: threading.Thread(target=simulate_key_enter).start(),
self.simulate_key_enter,
),
(
"copy_once",

View File

@ -571,6 +571,11 @@
"use": false,
"name": "进行一次OCR",
"keystring": ""
},
"_27": {
"use": false,
"name": "模拟按键Enter",
"keystring": ""
}
}
},