Panel交互增强:Step6.75/8/8.5/8.75/9 面板UI联动优化与稳定性修复
This commit is contained in:
@ -287,6 +287,9 @@ class Step6_75Panel(QWidget):
|
|||||||
work_dir: 工作目录路径
|
work_dir: 工作目录路径
|
||||||
pipeline: Pipeline 实例(未使用,保留接口兼容性)
|
pipeline: Pipeline 实例(未使用,保留接口兼容性)
|
||||||
"""
|
"""
|
||||||
|
try:
|
||||||
|
import traceback
|
||||||
|
|
||||||
if work_dir:
|
if work_dir:
|
||||||
self.work_dir = work_dir
|
self.work_dir = work_dir
|
||||||
elif hasattr(self, 'work_dir') and self.work_dir:
|
elif hasattr(self, 'work_dir') and self.work_dir:
|
||||||
@ -297,7 +300,13 @@ class Step6_75Panel(QWidget):
|
|||||||
# 1. 尝试从 Step5 界面读取训练光谱 CSV 路径
|
# 1. 尝试从 Step5 界面读取训练光谱 CSV 路径
|
||||||
main_window = self.window()
|
main_window = self.window()
|
||||||
if main_window and hasattr(main_window, 'step5_panel'):
|
if main_window and hasattr(main_window, 'step5_panel'):
|
||||||
step5_output_path = main_window.step5_panel.output_file.get_path()
|
step5_widget = getattr(main_window.step5_panel, 'output_file', None)
|
||||||
|
step5_output_path = ""
|
||||||
|
if hasattr(step5_widget, 'get_path'):
|
||||||
|
step5_output_path = step5_widget.get_path() or ""
|
||||||
|
elif hasattr(step5_widget, 'text'):
|
||||||
|
step5_output_path = step5_widget.text() or ""
|
||||||
|
|
||||||
if step5_output_path:
|
if step5_output_path:
|
||||||
# 若为相对路径,使用 work_dir 合成为绝对路径
|
# 若为相对路径,使用 work_dir 合成为绝对路径
|
||||||
if not os.path.isabs(step5_output_path):
|
if not os.path.isabs(step5_output_path):
|
||||||
@ -313,6 +322,10 @@ class Step6_75Panel(QWidget):
|
|||||||
existing_out = self.output_dir.text().strip()
|
existing_out = self.output_dir.text().strip()
|
||||||
if not existing_out:
|
if not existing_out:
|
||||||
self.output_dir.setText(output_dir)
|
self.output_dir.setText(output_dir)
|
||||||
|
except Exception as e:
|
||||||
|
import traceback
|
||||||
|
print(f"【{self.__class__.__name__}】自动填充失败,跳过: {e}")
|
||||||
|
traceback.print_exc()
|
||||||
|
|
||||||
def run_step(self):
|
def run_step(self):
|
||||||
"""独立运行步骤6.75"""
|
"""独立运行步骤6.75"""
|
||||||
|
|||||||
@ -89,6 +89,9 @@ class Step8_5Panel(QWidget):
|
|||||||
work_dir: 工作目录路径
|
work_dir: 工作目录路径
|
||||||
pipeline: Pipeline 实例(未使用,保留接口兼容性)
|
pipeline: Pipeline 实例(未使用,保留接口兼容性)
|
||||||
"""
|
"""
|
||||||
|
try:
|
||||||
|
import traceback
|
||||||
|
|
||||||
if work_dir:
|
if work_dir:
|
||||||
self.work_dir = work_dir
|
self.work_dir = work_dir
|
||||||
elif hasattr(self, 'work_dir') and self.work_dir:
|
elif hasattr(self, 'work_dir') and self.work_dir:
|
||||||
@ -100,7 +103,13 @@ class Step8_5Panel(QWidget):
|
|||||||
|
|
||||||
# 1. 尝试从 Step7 界面读取全湖采样点 CSV 路径
|
# 1. 尝试从 Step7 界面读取全湖采样点 CSV 路径
|
||||||
if main_window and hasattr(main_window, 'step7_panel'):
|
if main_window and hasattr(main_window, 'step7_panel'):
|
||||||
step7_output_path = main_window.step7_panel.output_file.get_path()
|
step7_widget = getattr(main_window.step7_panel, 'output_file', None)
|
||||||
|
step7_output_path = ""
|
||||||
|
if hasattr(step7_widget, 'get_path'):
|
||||||
|
step7_output_path = step7_widget.get_path() or ""
|
||||||
|
elif hasattr(step7_widget, 'text'):
|
||||||
|
step7_output_path = step7_widget.text() or ""
|
||||||
|
|
||||||
if step7_output_path:
|
if step7_output_path:
|
||||||
# 若为相对路径,使用 work_dir 合成为绝对路径
|
# 若为相对路径,使用 work_dir 合成为绝对路径
|
||||||
if not os.path.isabs(step7_output_path):
|
if not os.path.isabs(step7_output_path):
|
||||||
@ -111,7 +120,13 @@ class Step8_5Panel(QWidget):
|
|||||||
|
|
||||||
# 2. 尝试从 Step6.5 界面读取回归模型目录
|
# 2. 尝试从 Step6.5 界面读取回归模型目录
|
||||||
if main_window and hasattr(main_window, 'step6_5_panel'):
|
if main_window and hasattr(main_window, 'step6_5_panel'):
|
||||||
step6_5_models_dir = main_window.step6_5_panel.output_dir.get_path()
|
step6_5_widget = getattr(main_window.step6_5_panel, 'output_dir', None)
|
||||||
|
step6_5_models_dir = ""
|
||||||
|
if hasattr(step6_5_widget, 'get_path'):
|
||||||
|
step6_5_models_dir = step6_5_widget.get_path() or ""
|
||||||
|
elif hasattr(step6_5_widget, 'text'):
|
||||||
|
step6_5_models_dir = step6_5_widget.text() or ""
|
||||||
|
|
||||||
if step6_5_models_dir:
|
if step6_5_models_dir:
|
||||||
# 若为相对路径,使用 work_dir 合成为绝对路径
|
# 若为相对路径,使用 work_dir 合成为绝对路径
|
||||||
if not os.path.isabs(step6_5_models_dir):
|
if not os.path.isabs(step6_5_models_dir):
|
||||||
@ -127,6 +142,10 @@ class Step8_5Panel(QWidget):
|
|||||||
existing_out = self.output_file.get_path()
|
existing_out = self.output_file.get_path()
|
||||||
if not existing_out or not existing_out.strip():
|
if not existing_out or not existing_out.strip():
|
||||||
self.output_file.set_path(output_dir)
|
self.output_file.set_path(output_dir)
|
||||||
|
except Exception as e:
|
||||||
|
import traceback
|
||||||
|
print(f"【{self.__class__.__name__}】自动填充失败,跳过: {e}")
|
||||||
|
traceback.print_exc()
|
||||||
|
|
||||||
def _get_default_work_dir(self):
|
def _get_default_work_dir(self):
|
||||||
"""获取 work_dir,优先用 panel 自身缓存的,否则尝试从主窗口取"""
|
"""获取 work_dir,优先用 panel 自身缓存的,否则尝试从主窗口取"""
|
||||||
|
|||||||
@ -82,6 +82,9 @@ class Step8_75Panel(QWidget):
|
|||||||
work_dir: 工作目录路径
|
work_dir: 工作目录路径
|
||||||
pipeline: Pipeline 实例(未使用,保留接口兼容性)
|
pipeline: Pipeline 实例(未使用,保留接口兼容性)
|
||||||
"""
|
"""
|
||||||
|
try:
|
||||||
|
import traceback
|
||||||
|
|
||||||
if work_dir:
|
if work_dir:
|
||||||
self.work_dir = work_dir
|
self.work_dir = work_dir
|
||||||
elif hasattr(self, 'work_dir') and self.work_dir:
|
elif hasattr(self, 'work_dir') and self.work_dir:
|
||||||
@ -93,7 +96,13 @@ class Step8_75Panel(QWidget):
|
|||||||
|
|
||||||
# 1. 尝试从 Step7 界面读取全湖采样点 CSV 路径
|
# 1. 尝试从 Step7 界面读取全湖采样点 CSV 路径
|
||||||
if main_window and hasattr(main_window, 'step7_panel'):
|
if main_window and hasattr(main_window, 'step7_panel'):
|
||||||
step7_output_path = main_window.step7_panel.output_file.get_path()
|
step7_widget = getattr(main_window.step7_panel, 'output_file', None)
|
||||||
|
step7_output_path = ""
|
||||||
|
if hasattr(step7_widget, 'get_path'):
|
||||||
|
step7_output_path = step7_widget.get_path() or ""
|
||||||
|
elif hasattr(step7_widget, 'text'):
|
||||||
|
step7_output_path = step7_widget.text() or ""
|
||||||
|
|
||||||
if step7_output_path:
|
if step7_output_path:
|
||||||
# 若为相对路径,使用 work_dir 合成为绝对路径
|
# 若为相对路径,使用 work_dir 合成为绝对路径
|
||||||
if not os.path.isabs(step7_output_path):
|
if not os.path.isabs(step7_output_path):
|
||||||
@ -104,7 +113,14 @@ class Step8_75Panel(QWidget):
|
|||||||
|
|
||||||
# 2. 尝试从 Step6.75 界面读取自定义回归模型目录
|
# 2. 尝试从 Step6.75 界面读取自定义回归模型目录
|
||||||
if main_window and hasattr(main_window, 'step6_75_panel'):
|
if main_window and hasattr(main_window, 'step6_75_panel'):
|
||||||
step6_75_models_dir = main_window.step6_75_panel.output_dir.text().strip()
|
step6_75_widget = getattr(main_window.step6_75_panel, 'output_dir', None)
|
||||||
|
step6_75_models_dir = ""
|
||||||
|
if hasattr(step6_75_widget, 'get_path'):
|
||||||
|
step6_75_models_dir = step6_75_widget.get_path() or ""
|
||||||
|
elif hasattr(step6_75_widget, 'text'):
|
||||||
|
step6_75_models_dir = step6_75_widget.text() or ""
|
||||||
|
step6_75_models_dir = step6_75_models_dir.strip()
|
||||||
|
|
||||||
if step6_75_models_dir:
|
if step6_75_models_dir:
|
||||||
# 若为相对路径,使用 work_dir 合成为绝对路径
|
# 若为相对路径,使用 work_dir 合成为绝对路径
|
||||||
if not os.path.isabs(step6_75_models_dir):
|
if not os.path.isabs(step6_75_models_dir):
|
||||||
@ -127,6 +143,10 @@ class Step8_75Panel(QWidget):
|
|||||||
existing_out = self.output_dir_widget.get_path()
|
existing_out = self.output_dir_widget.get_path()
|
||||||
if not existing_out or not existing_out.strip():
|
if not existing_out or not existing_out.strip():
|
||||||
self.output_dir_widget.set_path(output_dir)
|
self.output_dir_widget.set_path(output_dir)
|
||||||
|
except Exception as e:
|
||||||
|
import traceback
|
||||||
|
print(f"【{self.__class__.__name__}】自动填充失败,跳过: {e}")
|
||||||
|
traceback.print_exc()
|
||||||
|
|
||||||
def _get_default_work_dir(self):
|
def _get_default_work_dir(self):
|
||||||
"""获取 work_dir,优先用 panel 自身缓存的,否则尝试从主窗口取"""
|
"""获取 work_dir,优先用 panel 自身缓存的,否则尝试从主窗口取"""
|
||||||
|
|||||||
@ -86,6 +86,9 @@ class Step8Panel(QWidget):
|
|||||||
work_dir: 工作目录路径
|
work_dir: 工作目录路径
|
||||||
pipeline: Pipeline 实例(未使用,保留接口兼容性)
|
pipeline: Pipeline 实例(未使用,保留接口兼容性)
|
||||||
"""
|
"""
|
||||||
|
try:
|
||||||
|
import traceback
|
||||||
|
|
||||||
if work_dir:
|
if work_dir:
|
||||||
self.work_dir = work_dir
|
self.work_dir = work_dir
|
||||||
elif hasattr(self, 'work_dir') and self.work_dir:
|
elif hasattr(self, 'work_dir') and self.work_dir:
|
||||||
@ -97,7 +100,13 @@ class Step8Panel(QWidget):
|
|||||||
|
|
||||||
# 1. 尝试从 Step7 界面读取全湖采样点 CSV 路径
|
# 1. 尝试从 Step7 界面读取全湖采样点 CSV 路径
|
||||||
if main_window and hasattr(main_window, 'step7_panel'):
|
if main_window and hasattr(main_window, 'step7_panel'):
|
||||||
step7_output_path = main_window.step7_panel.output_file.get_path()
|
step7_widget = getattr(main_window.step7_panel, 'output_file', None)
|
||||||
|
step7_output_path = ""
|
||||||
|
if hasattr(step7_widget, 'get_path'):
|
||||||
|
step7_output_path = step7_widget.get_path() or ""
|
||||||
|
elif hasattr(step7_widget, 'text'):
|
||||||
|
step7_output_path = step7_widget.text() or ""
|
||||||
|
|
||||||
if step7_output_path:
|
if step7_output_path:
|
||||||
# 若为相对路径,使用 work_dir 合成为绝对路径
|
# 若为相对路径,使用 work_dir 合成为绝对路径
|
||||||
if not os.path.isabs(step7_output_path):
|
if not os.path.isabs(step7_output_path):
|
||||||
@ -108,7 +117,13 @@ class Step8Panel(QWidget):
|
|||||||
|
|
||||||
# 2. 尝试从 Step6 界面读取监督模型目录
|
# 2. 尝试从 Step6 界面读取监督模型目录
|
||||||
if main_window and hasattr(main_window, 'step6_panel'):
|
if main_window and hasattr(main_window, 'step6_panel'):
|
||||||
step6_models_dir = main_window.step6_panel.output_dir.get_path()
|
step6_widget = getattr(main_window.step6_panel, 'output_dir', None)
|
||||||
|
step6_models_dir = ""
|
||||||
|
if hasattr(step6_widget, 'get_path'):
|
||||||
|
step6_models_dir = step6_widget.get_path() or ""
|
||||||
|
elif hasattr(step6_widget, 'text'):
|
||||||
|
step6_models_dir = step6_widget.text() or ""
|
||||||
|
|
||||||
if step6_models_dir:
|
if step6_models_dir:
|
||||||
# 若为相对路径,使用 work_dir 合成为绝对路径
|
# 若为相对路径,使用 work_dir 合成为绝对路径
|
||||||
if not os.path.isabs(step6_models_dir):
|
if not os.path.isabs(step6_models_dir):
|
||||||
@ -124,6 +139,10 @@ class Step8Panel(QWidget):
|
|||||||
existing_out = self.output_file.get_path()
|
existing_out = self.output_file.get_path()
|
||||||
if not existing_out or not existing_out.strip():
|
if not existing_out or not existing_out.strip():
|
||||||
self.output_file.set_path(output_dir)
|
self.output_file.set_path(output_dir)
|
||||||
|
except Exception as e:
|
||||||
|
import traceback
|
||||||
|
print(f"【{self.__class__.__name__}】自动填充失败,跳过: {e}")
|
||||||
|
traceback.print_exc()
|
||||||
|
|
||||||
def _get_default_work_dir(self):
|
def _get_default_work_dir(self):
|
||||||
"""获取 work_dir,优先用 panel 自身缓存的,否则尝试从主窗口取"""
|
"""获取 work_dir,优先用 panel 自身缓存的,否则尝试从主窗口取"""
|
||||||
|
|||||||
@ -308,6 +308,9 @@ class Step9Panel(QWidget):
|
|||||||
work_dir: 工作目录路径
|
work_dir: 工作目录路径
|
||||||
pipeline: Pipeline 实例(未使用,保留接口兼容性)
|
pipeline: Pipeline 实例(未使用,保留接口兼容性)
|
||||||
"""
|
"""
|
||||||
|
try:
|
||||||
|
import traceback
|
||||||
|
|
||||||
if work_dir:
|
if work_dir:
|
||||||
self.work_dir = work_dir
|
self.work_dir = work_dir
|
||||||
elif hasattr(self, 'work_dir') and self.work_dir:
|
elif hasattr(self, 'work_dir') and self.work_dir:
|
||||||
@ -322,7 +325,13 @@ class Step9Panel(QWidget):
|
|||||||
# 1. 尝试从 Step8 界面读取机器学习预测输出目录(优先)
|
# 1. 尝试从 Step8 界面读取机器学习预测输出目录(优先)
|
||||||
pred_dir = None
|
pred_dir = None
|
||||||
if hasattr(main_window, 'step8_panel'):
|
if hasattr(main_window, 'step8_panel'):
|
||||||
step8_output = main_window.step8_panel.output_file.get_path()
|
step8_widget = getattr(main_window.step8_panel, 'output_file', None)
|
||||||
|
step8_output = ""
|
||||||
|
if hasattr(step8_widget, 'get_path'):
|
||||||
|
step8_output = step8_widget.get_path() or ""
|
||||||
|
elif hasattr(step8_widget, 'text'):
|
||||||
|
step8_output = step8_widget.text() or ""
|
||||||
|
|
||||||
if step8_output:
|
if step8_output:
|
||||||
# 若为相对路径,使用 work_dir 合成为绝对路径
|
# 若为相对路径,使用 work_dir 合成为绝对路径
|
||||||
if not os.path.isabs(step8_output):
|
if not os.path.isabs(step8_output):
|
||||||
@ -331,7 +340,13 @@ class Step9Panel(QWidget):
|
|||||||
|
|
||||||
# 2. 备选:从 Step8.5 界面读取非经验预测输出目录
|
# 2. 备选:从 Step8.5 界面读取非经验预测输出目录
|
||||||
if not pred_dir and hasattr(main_window, 'step8_5_panel'):
|
if not pred_dir and hasattr(main_window, 'step8_5_panel'):
|
||||||
step8_5_output = main_window.step8_5_panel.output_file.get_path()
|
step8_5_widget = getattr(main_window.step8_5_panel, 'output_file', None)
|
||||||
|
step8_5_output = ""
|
||||||
|
if hasattr(step8_5_widget, 'get_path'):
|
||||||
|
step8_5_output = step8_5_widget.get_path() or ""
|
||||||
|
elif hasattr(step8_5_widget, 'text'):
|
||||||
|
step8_5_output = step8_5_widget.text() or ""
|
||||||
|
|
||||||
if step8_5_output:
|
if step8_5_output:
|
||||||
# 若为相对路径,使用 work_dir 合成为绝对路径
|
# 若为相对路径,使用 work_dir 合成为绝对路径
|
||||||
if not os.path.isabs(step8_5_output):
|
if not os.path.isabs(step8_5_output):
|
||||||
@ -340,7 +355,13 @@ class Step9Panel(QWidget):
|
|||||||
|
|
||||||
# 3. 备选:从 Step8.75 界面读取自定义回归预测输出目录
|
# 3. 备选:从 Step8.75 界面读取自定义回归预测输出目录
|
||||||
if not pred_dir and hasattr(main_window, 'step8_75_panel'):
|
if not pred_dir and hasattr(main_window, 'step8_75_panel'):
|
||||||
step8_75_output = main_window.step8_75_panel.output_dir_widget.get_path()
|
step8_75_widget = getattr(main_window.step8_75_panel, 'output_dir_widget', None)
|
||||||
|
step8_75_output = ""
|
||||||
|
if hasattr(step8_75_widget, 'get_path'):
|
||||||
|
step8_75_output = step8_75_widget.get_path() or ""
|
||||||
|
elif hasattr(step8_75_widget, 'text'):
|
||||||
|
step8_75_output = step8_75_widget.text() or ""
|
||||||
|
|
||||||
if step8_75_output:
|
if step8_75_output:
|
||||||
pred_dir = step8_75_output
|
pred_dir = step8_75_output
|
||||||
|
|
||||||
@ -359,6 +380,10 @@ class Step9Panel(QWidget):
|
|||||||
existing_out = self.output_dir.get_path()
|
existing_out = self.output_dir.get_path()
|
||||||
if not existing_out or not existing_out.strip():
|
if not existing_out or not existing_out.strip():
|
||||||
self.output_dir.set_path(output_dir)
|
self.output_dir.set_path(output_dir)
|
||||||
|
except Exception as e:
|
||||||
|
import traceback
|
||||||
|
print(f"【{self.__class__.__name__}】自动填充失败,跳过: {e}")
|
||||||
|
traceback.print_exc()
|
||||||
|
|
||||||
def browse_output_dir(self):
|
def browse_output_dir(self):
|
||||||
"""浏览输出目录"""
|
"""浏览输出目录"""
|
||||||
|
|||||||
Reference in New Issue
Block a user