路由壳升级:TaskWorker 三信号 + main_router→main_view 迁移(54/54 smoke 通过)
This commit is contained in:
@ -2,7 +2,7 @@
|
||||
"""
|
||||
PlaceholderService —— 通用占位后端(用于尚未迁移的步骤)
|
||||
|
||||
返回 ``{"status": "not_implemented", ...}``,main_router 据此在日志区
|
||||
返回 ``{"status": "not_implemented", ...}``,main_view 据此在日志区
|
||||
输出友好提示;不抛异常、不阻塞 UI 线程。
|
||||
"""
|
||||
|
||||
@ -15,7 +15,7 @@ def execute_placeholder(config: Dict[str, Any]) -> Dict[str, Any]:
|
||||
"""通用占位执行函数
|
||||
|
||||
Args:
|
||||
config: 由 view.get_config() 序列化、再经 main_router 注入 work_dir 的字典
|
||||
config: 由 view.get_config() 序列化、再经 main_view 注入 work_dir 的字典
|
||||
|
||||
Returns:
|
||||
标准结果字典 ``{status, output_path, message}``,其中 status="not_implemented"
|
||||
|
||||
@ -3,14 +3,14 @@
|
||||
Step1 后端计算服务(水域掩膜生成)
|
||||
=====================================
|
||||
|
||||
这是一个**纯计算函数**——绝对不引用 PyQt、绝对不引用 main_router、
|
||||
这是一个**纯计算函数**——绝对不引用 PyQt、绝对不引用 main_view、
|
||||
绝对不读写全局变量。它只:
|
||||
|
||||
1. 从 ``config`` 字典读取参数;
|
||||
2. 调用旧版 ``WaterMaskStep.run`` 执行水域掩膜生成;
|
||||
3. 返回结果字典 ``{status, output_path, message}``。
|
||||
|
||||
调用入口(由 main_router 在后台 QThread 中调用):
|
||||
调用入口(由 main_view 在后台 QThread 中调用):
|
||||
|
||||
execute_step1({
|
||||
"mask_path": "D:/xx.shp", # 现有掩膜路径(NDWI 模式下可为 None)
|
||||
@ -18,7 +18,7 @@ Step1 后端计算服务(水域掩膜生成)
|
||||
"ndwi_threshold": 0.4, # NDWI 阈值
|
||||
"img_path": "D:/ref.dat", # 参考影像
|
||||
"output_path": "D:/mask.dat", # NDWI 输出路径(可选)
|
||||
"work_dir": "D:/workspace", # 工作目录(main_router 注入)
|
||||
"work_dir": "D:/workspace", # 工作目录(main_view 注入)
|
||||
})
|
||||
|
||||
返回字典字段:
|
||||
@ -56,7 +56,7 @@ def execute_step1(config: Dict[str, Any]) -> Dict[str, Any]:
|
||||
"""Step 1 后端计算入口——纯函数
|
||||
|
||||
Args:
|
||||
config: 由前端 view.get_config() 序列化、再经 main_router 注入 work_dir 的字典
|
||||
config: 由前端 view.get_config() 序列化、再经 main_view 注入 work_dir 的字典
|
||||
|
||||
Returns:
|
||||
标准结果字典 ``{status, output_path, message, mode}``
|
||||
@ -87,7 +87,7 @@ def execute_step1(config: Dict[str, Any]) -> Dict[str, Any]:
|
||||
generate_png=True,
|
||||
output_path=output_path,
|
||||
water_mask_dir=water_mask_dir,
|
||||
callback=None, # 日志由 main_router 统一接管
|
||||
callback=None, # 日志由 main_view 统一接管
|
||||
)
|
||||
except FileNotFoundError as e:
|
||||
return {
|
||||
|
||||
Reference in New Issue
Block a user