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

@ -99,6 +99,9 @@ class Step8Panel(QWidget):
if main_window and hasattr(main_window, 'step7_panel'):
step7_output_path = main_window.step7_panel.output_file.get_path()
if step7_output_path:
# 若为相对路径,使用 work_dir 合成为绝对路径
if not os.path.isabs(step7_output_path):
step7_output_path = os.path.join(self.work_dir or '', step7_output_path).replace('\\', '/')
existing = self.sampling_csv_file.get_path()
if not existing or not existing.strip():
self.sampling_csv_file.set_path(step7_output_path)
@ -107,6 +110,9 @@ class Step8Panel(QWidget):
if main_window and hasattr(main_window, 'step6_panel'):
step6_models_dir = main_window.step6_panel.output_dir.get_path()
if step6_models_dir:
# 若为相对路径,使用 work_dir 合成为绝对路径
if not os.path.isabs(step6_models_dir):
step6_models_dir = os.path.join(self.work_dir or '', step6_models_dir).replace('\\', '/')
existing_models = self.models_dir_file.get_path()
if not existing_models or not existing_models.strip():
self.models_dir_file.set_path(step6_models_dir)