chore: tk 全量提交(新增 formats 模块与界面体检测试包,更新核心/UI/测试/文档)
This commit is contained in:
@@ -43,6 +43,18 @@ _LAST_SAVE_DIR = {"d": ""} # 本次运行记住的上一另存位
|
||||
|
||||
|
||||
class _BridgeApi:
|
||||
def set_title(self, text=""):
|
||||
"""全局语言切换时同步软件窗口标题(2026-10-19 主人定:语言控制整个软件)。"""
|
||||
try:
|
||||
import webview
|
||||
win = webview.windows[0] if webview.windows else None
|
||||
if win is None:
|
||||
return {"ok": False, "msg": "窗口未就绪"}
|
||||
win.set_title(str(text or "造价审核")[:80])
|
||||
return {"ok": True}
|
||||
except Exception as e:
|
||||
return {"ok": False, "msg": str(e)}
|
||||
|
||||
def export_save_as(self, session_id, suggested_name=""):
|
||||
"""决策 92(主人定流程):点导出=①先弹原生另存为选路径(此刻还不生成,大工程不再干等)
|
||||
→②后台线程生成+分块写盘(逐条目进度经 evaluate_js 推给页面进度条)
|
||||
@@ -353,6 +365,21 @@ def warn_webview2_missing():
|
||||
pass
|
||||
|
||||
|
||||
_SRV_ERR = {}
|
||||
|
||||
|
||||
def _run_srv():
|
||||
"""后台服务线程:异常写进 launch.log,避免只剩一句“端口起不来”。"""
|
||||
try:
|
||||
api_server.run()
|
||||
except Exception:
|
||||
import traceback
|
||||
tb = traceback.format_exc()
|
||||
_SRV_ERR["tb"] = tb
|
||||
_log("本地服务异常退出:\n" + tb)
|
||||
print("本地服务异常退出:\n" + tb, flush=True)
|
||||
|
||||
|
||||
def main():
|
||||
_log("启动中…(端口 %d)" % PORT)
|
||||
|
||||
@@ -401,10 +428,15 @@ def main():
|
||||
print("端口 %d 被残留进程占用且无响应,请到任务管理器结束 python.exe 后再双击本文件" % PORT, flush=True)
|
||||
return 1
|
||||
if not reused:
|
||||
threading.Thread(target=api_server.run, daemon=True).start()
|
||||
threading.Thread(target=_run_srv, daemon=True).start()
|
||||
if not wait_ready():
|
||||
_log("服务启动失败:端口 %d 起不来(可能被其他程序占用)" % PORT)
|
||||
print("服务启动失败,请检查端口 %d 是否被占用" % PORT, flush=True)
|
||||
if _SRV_ERR.get("tb"):
|
||||
_log("服务异常:\n" + _SRV_ERR["tb"])
|
||||
print("服务异常(详见 launch.log):%s" % _SRV_ERR["tb"].splitlines()[-1], flush=True)
|
||||
else:
|
||||
print("服务启动失败,请检查端口 %d 是否被占用;若刚关过软件,请等 5 秒、只开一个窗口再试" % PORT,
|
||||
flush=True)
|
||||
return 1
|
||||
_log("本地服务就绪")
|
||||
|
||||
|
||||
Reference in New Issue
Block a user