From b976c5ab3201ba92e17d68a50709f2dfe6cc1dfd Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E6=81=8D=E5=85=AE=E6=83=9A=E5=85=AE?= <101191390+HIllya51@users.noreply.github.com> Date: Sun, 20 Oct 2024 00:37:51 +0800 Subject: [PATCH] ... --- .gitignore | 2 ++ src/LunaTranslator/winrtutils.py | 20 +++++++++++++------- src/build.py | 8 ++++---- src/plugins/.vscode/settings.json | 5 +++++ src/plugins/CMakeLists.txt | 4 ++-- 5 files changed, 26 insertions(+), 13 deletions(-) create mode 100644 src/plugins/.vscode/settings.json diff --git a/.gitignore b/.gitignore index 08394096..8ceaf369 100644 --- a/.gitignore +++ b/.gitignore @@ -31,3 +31,5 @@ src/files/plugins src/files/themes src/run37.bat src/run3732.bat +src/plugins/builds +src/plugins/libs/webview2 \ No newline at end of file diff --git a/src/LunaTranslator/winrtutils.py b/src/LunaTranslator/winrtutils.py index ad817f54..81f12477 100644 --- a/src/LunaTranslator/winrtutils.py +++ b/src/LunaTranslator/winrtutils.py @@ -10,7 +10,7 @@ from ctypes import ( POINTER, c_char, ) -import platform, gobject +import platform, gobject, threading try: if platform.system() != "Windows" or int(platform.version().split(".")[0]) < 6: @@ -43,13 +43,19 @@ if winrtutilsdll: def cb(x1, y1, x2, y2, text): ret.append((text, x1, y1, x2, y2)) - _OCR_f( - data, - len(data), - lang, - space, - CFUNCTYPE(None, c_uint, c_uint, c_uint, c_uint, c_wchar_p)(cb), + t = threading.Thread( + target=_OCR_f, + args=( + data, + len(data), + lang, + space, + CFUNCTYPE(None, c_uint, c_uint, c_uint, c_uint, c_wchar_p)(cb), + ), ) + t.start() + t.join() + # 如果不这样,就会在在ui线程执行时,BitmapDecoder::CreateAsync(memoryStream).get()等Async函数会导致阻塞卡住。 return ret _winrt_capture_window = winrtutilsdll.winrt_capture_window diff --git a/src/build.py b/src/build.py index 8bf5fc2a..51f0ae4e 100644 --- a/src/build.py +++ b/src/build.py @@ -23,7 +23,7 @@ mylinks = { "mecab.zip": "https://github.com/HIllya51/RESOURCES/releases/download/common/mecab.zip", "ocr.zip": "https://github.com/HIllya51/RESOURCES/releases/download/common/ocr.zip", "magpie.zip": "https://github.com/HIllya51/RESOURCES/releases/download/common/magpie.zip", - "stylesheets-main.zip": "https://github.com/HIllya51/RESOURCES/releases/download/common/stylesheets-main.zip", + "themes.zip": "https://github.com/HIllya51/RESOURCES/releases/download/common/themes.zip", } @@ -233,9 +233,9 @@ def buildPlugins(): def downloadsomething(): os.chdir(rootDir + "\\temp") - subprocess.run(f"curl -LO {mylinks['stylesheets-main.zip']}") - subprocess.run(f"7z x stylesheets-main.zip -oALL") - move_directory_contents("ALL/stylesheets-main", rootDir + "\\files\\themes") + subprocess.run(f"curl -LO {mylinks['themes.zip']}") + subprocess.run(f"7z x themes.zip -oALL") + move_directory_contents("ALL/themes", rootDir + "\\files\\themes") def downloadbass(): diff --git a/src/plugins/.vscode/settings.json b/src/plugins/.vscode/settings.json new file mode 100644 index 00000000..b5be4e5e --- /dev/null +++ b/src/plugins/.vscode/settings.json @@ -0,0 +1,5 @@ +{ + "files.associations": { + "valarray": "cpp" + } +} \ No newline at end of file diff --git a/src/plugins/CMakeLists.txt b/src/plugins/CMakeLists.txt index b443f554..79610b42 100644 --- a/src/plugins/CMakeLists.txt +++ b/src/plugins/CMakeLists.txt @@ -28,8 +28,8 @@ set(CMAKE_MODULE_PATH ${CMAKE_MODULE_PATH} ${CMAKE_SOURCE_DIR}/version) include(generate_product_version) set(VERSION_MAJOR 5) -set(VERSION_MINOR 43) -set(VERSION_PATCH 2) +set(VERSION_MINOR 45) +set(VERSION_PATCH 0) add_library(pch pch.cpp) target_precompile_headers(pch PUBLIC pch.h)