Files
CTTools0.2Plus/main_events.py
2026-01-28 17:01:19 +08:00

30 lines
1.1 KiB
Python
Raw Blame History

This file contains ambiguous Unicode characters
This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.
from nicegui import app, ui
from datas.global_data import global_data
import asyncio
from stuctor.ope import Operator
# 选择文件点击
async def handle_click():
file = await app.native.main_window.create_file_dialog( # pyright: ignore[reportOptionalMemberAccess]
file_types = ('DOCX Files (*.docx;*.docx;*.docx)', )
)
if file is not None:
global_data.user_select_path = file[0]
# cpu-大纲转说明
async def handle_cpu_transform(log):
if not global_data.user_select_path or global_data.user_select_path == '还未选择路径':
ui.notify("请选择文件后重试", type = 'warning')
else:
global_data.progress_value = 0.1
global_data.is_loading = True
log.push("开始转换文档...")
await asyncio.sleep(0.1)
operation = Operator(str(global_data.user_select_path), "测试说明", "测试记录", log)
operation.main_parse('CPU')
operation.render()
global_data.progress_value = 1.0
log.push("转换完毕...")
ui.notify('转换完成请查看软件根目录输出docx', type = 'positive')
global_data.is_loading = False