refactor(gui): 专题图UI美化/目录寻路/掩膜继承/隐藏冗余回归步骤

This commit is contained in:
DXC
2026-05-10 17:02:58 +08:00
parent 9ba39a7bff
commit 5a55be286f
2 changed files with 28 additions and 13 deletions

View File

@ -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}")