From b8a1f4031edc0933f6f66116254b509f6a714431 Mon Sep 17 00:00:00 2001 From: test123456654321 <16307130148@fudan.edu.cn> Date: Mon, 28 Oct 2024 19:03:55 +0800 Subject: [PATCH] fix --- src/LunaTranslator/gui/showword.py | 10 ++++++++++ src/LunaTranslator/myutils/hwnd.py | 2 +- src/LunaTranslator/textoutput/clipboard.py | 4 +++- src/plugins/CMakeLists.txt | 2 +- 4 files changed, 15 insertions(+), 3 deletions(-) diff --git a/src/LunaTranslator/gui/showword.py b/src/LunaTranslator/gui/showword.py index c6e92e8d..470354ea 100644 --- a/src/LunaTranslator/gui/showword.py +++ b/src/LunaTranslator/gui/showword.py @@ -442,6 +442,11 @@ class AnkiWindow(QWidget): ) ) + def createtbn(target: QLineEdit): + clearbtn = QPushButton(qtawesome.icon("fa.times"), "") + clearbtn.clicked.connect(lambda: target.clear()) + return clearbtn + self.audiopath = QLineEdit() self.audiopath.setReadOnly(True) self.audiopath_sentence = QLineEdit() @@ -558,6 +563,7 @@ class AnkiWindow(QWidget): recordbtn1, soundbutton, folder_open, + functools.partial(createtbn, self.audiopath), ] ), getboxlayout( @@ -567,6 +573,9 @@ class AnkiWindow(QWidget): recordbtn2, soundbutton2, folder_open2, + functools.partial( + createtbn, self.audiopath_sentence + ), ] ), getboxlayout( @@ -576,6 +585,7 @@ class AnkiWindow(QWidget): cropbutton, grabwindowbtn, folder_open3, + functools.partial(createtbn, self.editpath), ] ), self.viewimagelabel, diff --git a/src/LunaTranslator/myutils/hwnd.py b/src/LunaTranslator/myutils/hwnd.py index ec04681e..aea6acfa 100644 --- a/src/LunaTranslator/myutils/hwnd.py +++ b/src/LunaTranslator/myutils/hwnd.py @@ -74,7 +74,7 @@ def grabwindow(app="PNG", callback_origin=None, tocliponly=False): hwnd = gobject.baseobject.hwnd if not hwnd: - hwnd = windows.GetForegroundWindow() + return hwnd = windows.GetAncestor(hwnd) _ = windows.GetClientRect(hwnd) p = gdi_screenshot(0, 0, _[2], _[3], hwnd) diff --git a/src/LunaTranslator/textoutput/clipboard.py b/src/LunaTranslator/textoutput/clipboard.py index 20d43985..b5f11034 100644 --- a/src/LunaTranslator/textoutput/clipboard.py +++ b/src/LunaTranslator/textoutput/clipboard.py @@ -5,7 +5,9 @@ import winsharedutils class Outputer(Base): def dispatch(self, text): - if globalconfig["sourcestatus2"]["copy"]["use"]: + if globalconfig["sourcestatus2"]["copy"]["use"] and ( + not globalconfig["excule_from_self"] + ): return winsharedutils.clipboard_set(text) diff --git a/src/plugins/CMakeLists.txt b/src/plugins/CMakeLists.txt index ea7f8e62..4c0299cd 100644 --- a/src/plugins/CMakeLists.txt +++ b/src/plugins/CMakeLists.txt @@ -29,7 +29,7 @@ include(generate_product_version) set(VERSION_MAJOR 5) set(VERSION_MINOR 52) -set(VERSION_PATCH 1) +set(VERSION_PATCH 2) add_library(pch pch.cpp) target_precompile_headers(pch PUBLIC pch.h)