From 9ebe4fe4d33df54cafcbc795add81139f4276251 Mon Sep 17 00:00:00 2001 From: dxc Date: Tue, 9 Jun 2026 13:31:50 +0800 Subject: [PATCH] =?UTF-8?q?fix(gui):=20step8=5Fpanel=E5=A2=9E=E5=8A=A0Form?= =?UTF-8?q?ula=5FType/Coefficient=20UI=E6=94=AF=E6=8C=81=EF=BC=8Cget=5Fcon?= =?UTF-8?q?fig=E8=BE=93=E5=87=BAformula=5Fcoefficients?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/gui/panels/step8_panel.py | 19 +++++++++++++++++++ 1 file changed, 19 insertions(+) diff --git a/src/gui/panels/step8_panel.py b/src/gui/panels/step8_panel.py index b3f845a..74a084a 100644 --- a/src/gui/panels/step8_panel.py +++ b/src/gui/panels/step8_panel.py @@ -47,6 +47,7 @@ class Step8Panel(QWidget): self.builtin_formula_path = get_resource_path("waterindex.csv") self._formula_type_map: Dict[str, str] = {} self._formula_color_map: Dict[str, QColor] = {} + self._formula_coef_map: Dict[str, List[float]] = {} self.init_ui() self._auto_load_formulas() @@ -195,6 +196,7 @@ class Step8Panel(QWidget): return self._formula_type_map.clear() + self._formula_coef_map.clear() for _, row in df.iterrows(): name = str(row['Formula_Name']).strip() if not name: @@ -202,6 +204,17 @@ class Step8Panel(QWidget): ftype = str(row.get('Formula_Type', 'ratio')).strip().lower() self._formula_type_map[name] = ftype + # Parse Coefficient for concentration formulas + coef_str = str(row.get('Coefficient', '')).strip() + if coef_str: + try: + coeffs = [float(c.strip()) for c in coef_str.split(',') if c.strip()] + self._formula_coef_map[name] = coeffs + except Exception: + self._formula_coef_map[name] = [] + else: + self._formula_coef_map[name] = [] + self.formula_list.clear() self.index_checkboxes.clear() @@ -247,10 +260,16 @@ class Step8Panel(QWidget): name for name, item in self.index_checkboxes.items() if item.checkState() == Qt.Checked ] + # Build coefficient dict for selected formulas + formula_coefficients = { + name: self._formula_coef_map.get(name, []) + for name in selected + } return { 'training_csv_path': self.training_data_widget.get_path(), 'formula_csv_file': self.builtin_formula_path, 'formula_names': selected, + 'formula_coefficients': formula_coefficients, 'enabled': self.enable_checkbox.isChecked(), 'output_mode': self.mode_group.checkedId(), }