refactor(gui): 专题图UI美化/目录寻路/掩膜继承/隐藏冗余回归步骤
This commit is contained in:
@ -109,7 +109,7 @@ class Step9Panel(QWidget):
|
||||
mode_row.addStretch()
|
||||
layout.addLayout(mode_row)
|
||||
|
||||
# ---------- RadioButton 美化样式(选中状态更醒目) ----------
|
||||
# ---------- RadioButton 美化样式(选中状态为方形实心块,贴合主界面风格) ----------
|
||||
radio_style = """
|
||||
QRadioButton {
|
||||
font-size: 14px;
|
||||
@ -117,21 +117,16 @@ class Step9Panel(QWidget):
|
||||
color: #333333;
|
||||
}
|
||||
QRadioButton::indicator {
|
||||
width: 18px;
|
||||
height: 18px;
|
||||
width: 16px;
|
||||
height: 16px;
|
||||
border: 2px solid #999999;
|
||||
border-radius: 9px;
|
||||
border-radius: 3px;
|
||||
background-color: white;
|
||||
}
|
||||
QRadioButton::indicator:checked {
|
||||
border: 2px solid #0078d4;
|
||||
background-color: qradialgradient(
|
||||
cx:0.5, cy:0.5, radius:0.5,
|
||||
fx:0.5, fy:0.5,
|
||||
stop:0 #0078d4,
|
||||
stop:0.6 white,
|
||||
stop:1.0 white
|
||||
);
|
||||
background-color: #0078d4;
|
||||
image: none;
|
||||
}
|
||||
QRadioButton::indicator:hover {
|
||||
border: 2px solid #005a9e;
|
||||
@ -353,7 +348,7 @@ class Step9Panel(QWidget):
|
||||
if not main_window:
|
||||
return
|
||||
|
||||
# 1. 尝试从 Step8 界面读取机器学习预测输出目录(优先)
|
||||
# 1. 尝试从 Step8 界面读取机器学习预测输出目录(最优先)
|
||||
pred_dir = None
|
||||
if hasattr(main_window, 'step8_panel'):
|
||||
step8_widget = getattr(main_window.step8_panel, 'output_file', None)
|
||||
@ -367,7 +362,10 @@ class Step9Panel(QWidget):
|
||||
# 若为相对路径,使用 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)
|
||||
# 提取父目录后追加 Machine_Learning_Prediction(最底层真实子目录)
|
||||
base_pred_dir = str(Path(step8_output).parent)
|
||||
ml_pred_dir = Path(base_pred_dir) / "Machine_Learning_Prediction"
|
||||
pred_dir = str(ml_pred_dir) if ml_pred_dir.exists() else base_pred_dir
|
||||
|
||||
# 2. 备选:从 Step8.5 界面读取非经验预测输出目录
|
||||
if not pred_dir and hasattr(main_window, 'step8_5_panel'):
|
||||
@ -411,6 +409,14 @@ class Step9Panel(QWidget):
|
||||
existing_out = self.output_dir.get_path()
|
||||
if not existing_out or not existing_out.strip():
|
||||
self.output_dir.set_path(output_dir)
|
||||
|
||||
# 5. 自动继承步骤1的水域掩膜作为边界文件
|
||||
if self.work_dir:
|
||||
default_mask = Path(self.work_dir) / "1_water_mask" / "water_mask_from_shp.dat"
|
||||
if default_mask.exists():
|
||||
existing_boundary = (self.boundary_file.get_path() or "").strip()
|
||||
if not existing_boundary:
|
||||
self.boundary_file.set_path(str(default_mask))
|
||||
except Exception as e:
|
||||
import traceback
|
||||
print(f"【{self.__class__.__name__}】自动填充失败,跳过: {e}")
|
||||
|
||||
@ -1825,6 +1825,11 @@ class WaterQualityGUI(QMainWindow):
|
||||
for step_id, step_display in steps:
|
||||
item = QListWidgetItem(f" └─ {step_display}")
|
||||
item.setData(Qt.UserRole, step_id)
|
||||
|
||||
# 隐藏4个冗余回归步骤(树节点)
|
||||
if step_id in ("step6_5", "step6_75", "step8_5", "step8_75"):
|
||||
item.setHidden(True)
|
||||
|
||||
self.step_name_map[step_display] = step_id
|
||||
|
||||
# 设置步骤项的样式
|
||||
@ -1905,9 +1910,11 @@ class WaterQualityGUI(QMainWindow):
|
||||
|
||||
self.step6_5_panel = Step6_5Panel()
|
||||
self.step_stack.addTab(self.create_scroll_area(self.step6_5_panel), QIcon(self.get_icon_path("6.png")), "回归建模")
|
||||
self.step_stack.tabBar().setTabVisible(7, False) # 隐藏回归建模 Tab
|
||||
|
||||
self.step6_75_panel = Step6_75Panel()
|
||||
self.step_stack.addTab(self.create_scroll_area(self.step6_75_panel), QIcon(self.get_icon_path("6.png")), "自定义回归建模")
|
||||
self.step_stack.tabBar().setTabVisible(8, False) # 隐藏自定义回归建模 Tab
|
||||
|
||||
self.step7_panel = Step7Panel()
|
||||
self.step_stack.addTab(self.create_scroll_area(self.step7_panel), QIcon(self.get_icon_path("7.png")), "采样点布设")
|
||||
@ -1917,9 +1924,11 @@ class WaterQualityGUI(QMainWindow):
|
||||
|
||||
self.step8_5_panel = Step8_5Panel()
|
||||
self.step_stack.addTab(self.create_scroll_area(self.step8_5_panel), QIcon(self.get_icon_path("8.png")), "回归预测")
|
||||
self.step_stack.tabBar().setTabVisible(11, False) # 隐藏回归预测 Tab
|
||||
|
||||
self.step8_75_panel = Step8_75Panel()
|
||||
self.step_stack.addTab(self.create_scroll_area(self.step8_75_panel), QIcon(self.get_icon_path("8.png")), "自定义回归预测")
|
||||
self.step_stack.tabBar().setTabVisible(12, False) # 隐藏自定义回归预测 Tab
|
||||
|
||||
self.step9_panel = Step9Panel()
|
||||
self.step_stack.addTab(self.create_scroll_area(self.step9_panel), QIcon(self.get_icon_path("10.png")), "专题图生成")
|
||||
|
||||
Reference in New Issue
Block a user