From 5a55be286fdf1f92c8b2ff7bcca4af1ba32f504d Mon Sep 17 00:00:00 2001 From: DXC Date: Sun, 10 May 2026 17:02:58 +0800 Subject: [PATCH] =?UTF-8?q?refactor(gui):=20=E4=B8=93=E9=A2=98=E5=9B=BEUI?= =?UTF-8?q?=E7=BE=8E=E5=8C=96/=E7=9B=AE=E5=BD=95=E5=AF=BB=E8=B7=AF/?= =?UTF-8?q?=E6=8E=A9=E8=86=9C=E7=BB=A7=E6=89=BF/=E9=9A=90=E8=97=8F?= =?UTF-8?q?=E5=86=97=E4=BD=99=E5=9B=9E=E5=BD=92=E6=AD=A5=E9=AA=A4?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/gui/panels/step9_panel.py | 32 +++++++++++++++++++------------- src/gui/water_quality_gui.py | 9 +++++++++ 2 files changed, 28 insertions(+), 13 deletions(-) diff --git a/src/gui/panels/step9_panel.py b/src/gui/panels/step9_panel.py index 32462ba..9798053 100644 --- a/src/gui/panels/step9_panel.py +++ b/src/gui/panels/step9_panel.py @@ -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}") diff --git a/src/gui/water_quality_gui.py b/src/gui/water_quality_gui.py index 1e09ebe..eb11796 100644 --- a/src/gui/water_quality_gui.py +++ b/src/gui/water_quality_gui.py @@ -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")), "专题图生成")