格式统一
This commit is contained in:
@ -46,6 +46,11 @@ class WorkspaceManager:
|
|||||||
}
|
}
|
||||||
self.step_outputs = {}
|
self.step_outputs = {}
|
||||||
|
|
||||||
|
# ★ 2026-07-01:切换工作目录时清空缓存,防止旧目录的 OutputUpdated 重放
|
||||||
|
def clear_all_outputs(self):
|
||||||
|
"""清空所有缓存的步骤输出路径。工作目录切换时调用。"""
|
||||||
|
self.step_outputs.clear()
|
||||||
|
|
||||||
def _publish_outputs(self, step_id: str, outputs: dict):
|
def _publish_outputs(self, step_id: str, outputs: dict):
|
||||||
"""将发现的产出发布到 EventBus。
|
"""将发现的产出发布到 EventBus。
|
||||||
|
|
||||||
|
|||||||
@ -284,6 +284,9 @@ class WorkspaceInitializer(QObject):
|
|||||||
这些残留路径不会被自动更新。此方法遍历所有已加载面板,
|
这些残留路径不会被自动更新。此方法遍历所有已加载面板,
|
||||||
清除以旧 work_dir 开头的输出路径,确保后续 auto_populate_all() 能重新填充。
|
清除以旧 work_dir 开头的输出路径,确保后续 auto_populate_all() 能重新填充。
|
||||||
|
|
||||||
|
同时清空 WorkspaceManager 的 step_outputs 缓存,
|
||||||
|
防止旧目录的 OutputUpdated 事件在面板懒加载时被重放。
|
||||||
|
|
||||||
安全设计:
|
安全设计:
|
||||||
- 仅清除以旧 work_dir 开头的路径(保留用户手动指定的外部路径)
|
- 仅清除以旧 work_dir 开头的路径(保留用户手动指定的外部路径)
|
||||||
- 使用 os.path.normpath 归一化比较,兼容正反斜杠混用
|
- 使用 os.path.normpath 归一化比较,兼容正反斜杠混用
|
||||||
@ -292,6 +295,9 @@ class WorkspaceInitializer(QObject):
|
|||||||
if not norm_old:
|
if not norm_old:
|
||||||
return
|
return
|
||||||
|
|
||||||
|
# ★ 清空 WorkspaceManager 缓存,斩断旧目录的 OutputUpdated 重放链
|
||||||
|
self._workspace_manager.clear_all_outputs()
|
||||||
|
|
||||||
cleared_count = 0
|
cleared_count = 0
|
||||||
for step_id, panel in self._panel_factory.get_loaded_panels().items():
|
for step_id, panel in self._panel_factory.get_loaded_panels().items():
|
||||||
# 遍历面板中常见的输出/路径控件
|
# 遍历面板中常见的输出/路径控件
|
||||||
|
|||||||
Reference in New Issue
Block a user