修复所有 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

@ -324,12 +324,18 @@ class Step9Panel(QWidget):
if hasattr(main_window, 'step8_panel'):
step8_output = main_window.step8_panel.output_file.get_path()
if step8_output:
# 若为相对路径,使用 work_dir 合成为绝对路径
if not os.path.isabs(step8_output):
step8_output = os.path.join(self.work_dir or '', step8_output).replace('\\', '/')
pred_dir = str(Path(step8_output).parent)
# 2. 备选:从 Step8.5 界面读取非经验预测输出目录
if not pred_dir and hasattr(main_window, 'step8_5_panel'):
step8_5_output = main_window.step8_5_panel.output_file.get_path()
if step8_5_output:
# 若为相对路径,使用 work_dir 合成为绝对路径
if not os.path.isabs(step8_5_output):
step8_5_output = os.path.join(self.work_dir or '', step8_5_output).replace('\\', '/')
pred_dir = str(Path(step8_5_output).parent)
# 3. 备选:从 Step8.75 界面读取自定义回归预测输出目录