修复所有 Panel 的相对路径传递问题,防止 FileNotFoundError

This commit is contained in:
DXC
2026-05-08 09:40:33 +08:00
parent 0f36da742f
commit a4e6747b54
12 changed files with 77 additions and 4 deletions

View File

@ -145,6 +145,9 @@ class Step7Panel(QWidget):
deglint_path = main_window.step3_panel.output_file.get_path()
if deglint_path:
# 若为相对路径,使用 work_dir 合成为绝对路径
if not os.path.isabs(deglint_path):
deglint_path = os.path.join(self.work_dir or '', deglint_path).replace('\\', '/')
self.deglint_img_file.set_path(deglint_path)
# 2. 填充水域掩膜路径(优先从 pipeline.step_outputs 获取绝对路径)
@ -161,6 +164,9 @@ class Step7Panel(QWidget):
water_mask_path = main_window.step1_panel.output_file.get_path()
if water_mask_path:
# 若为相对路径,使用 work_dir 合成为绝对路径
if not os.path.isabs(water_mask_path):
water_mask_path = os.path.join(self.work_dir or '', water_mask_path).replace('\\', '/')
self.water_mask_file.set_path(water_mask_path)
# 3. 自动填充输出路径(绝对路径)