Skip to content

Commit eba5a34

Browse files
committed
feat: 添加文件夹收藏功能和修复Windows asyncio错误
- 修复Windows系统WSAStartup错误(WinError 10093),在工作线程中使用WindowsSelectorEventLoopPolicy - 添加文件夹选择器收藏功能,支持点击星星图标收藏/取消收藏 - 文件夹选择器支持显示隐藏文件夹 - 添加多种排序选项(名称、修改时间、大小) - 使用不区分大小写的排序 - 收藏配置自动保存到config.json,支持打包和开发环境
1 parent e55436a commit eba5a34

6 files changed

Lines changed: 475 additions & 14 deletions

File tree

desktop_qt_ui/app_logic.py

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1431,8 +1431,13 @@ def process(self):
14311431
loop = None
14321432
try:
14331433
import asyncio
1434+
import sys
14341435
self.log_received.emit("--- [1] THREAD: process() method entered, starting asyncio task.")
14351436

1437+
# 在Windows上的工作线程中,需要使用SelectorEventLoop而不是ProactorEventLoop
1438+
if sys.platform == 'win32':
1439+
asyncio.set_event_loop_policy(asyncio.WindowsSelectorEventLoopPolicy())
1440+
14361441
# 创建事件循环并保存任务引用
14371442
loop = asyncio.new_event_loop()
14381443
asyncio.set_event_loop(loop)

desktop_qt_ui/editor/core/async_job_manager.py

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -41,6 +41,11 @@ def _start_event_loop(self) -> None:
4141

4242
def run_loop():
4343
"""在线程中运行事件循环"""
44+
import sys
45+
# 在Windows上的工作线程中,需要使用SelectorEventLoop而不是ProactorEventLoop
46+
if sys.platform == 'win32':
47+
asyncio.set_event_loop_policy(asyncio.WindowsSelectorEventLoopPolicy())
48+
4449
self._loop = asyncio.new_event_loop()
4550
asyncio.set_event_loop(self._loop)
4651
self._running = True

desktop_qt_ui/services/export_service.py

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -518,6 +518,11 @@ def _execute_backend_render(self, image_path: str, regions_json_path: str,
518518
progress_callback("执行后端渲染...")
519519

520520
# 执行翻译(实际是渲染)
521+
import sys
522+
# 在Windows上的工作线程中,需要使用SelectorEventLoop而不是ProactorEventLoop
523+
if sys.platform == 'win32':
524+
asyncio.set_event_loop_policy(asyncio.WindowsSelectorEventLoopPolicy())
525+
521526
loop = asyncio.new_event_loop()
522527
asyncio.set_event_loop(loop)
523528

0 commit comments

Comments
 (0)