diff --git a/src/gui/panels/step11_map_panel.py b/src/gui/panels/step11_map_panel.py index 346acb2..bfd57d7 100644 --- a/src/gui/panels/step11_map_panel.py +++ b/src/gui/panels/step11_map_panel.py @@ -14,7 +14,7 @@ from typing import List, Optional _HERE = os.path.dirname(os.path.abspath(__file__)) if _HERE not in sys.path: sys.path.insert(0, _HERE) -from _step_path_resolver import resolve_subdir, get_step_output_path +from src.gui.panels._step_path_resolver import resolve_subdir, get_step_output_path from PyQt5.QtCore import Qt, QThread, pyqtSignal from PyQt5.QtWidgets import ( diff --git a/src/gui/panels/step6_feature_panel.py b/src/gui/panels/step6_feature_panel.py index 6f0a690..d8a2c62 100644 --- a/src/gui/panels/step6_feature_panel.py +++ b/src/gui/panels/step6_feature_panel.py @@ -12,7 +12,7 @@ from pathlib import Path _HERE = os.path.dirname(os.path.abspath(__file__)) if _HERE not in sys.path: sys.path.insert(0, _HERE) -from _step_path_resolver import resolve_subdir +from src.gui.panels._step_path_resolver import resolve_subdir from PyQt5.QtWidgets import ( QWidget, QVBoxLayout, QGroupBox, QFormLayout, QLabel, diff --git a/src/gui/panels/step8_ml_train_panel.py b/src/gui/panels/step8_ml_train_panel.py index d410b1e..278561a 100644 --- a/src/gui/panels/step8_ml_train_panel.py +++ b/src/gui/panels/step8_ml_train_panel.py @@ -12,7 +12,7 @@ from pathlib import Path _HERE = os.path.dirname(os.path.abspath(__file__)) if _HERE not in sys.path: sys.path.insert(0, _HERE) -from _step_path_resolver import get_step_output_path, resolve_step_widget, resolve_subdir +from src.gui.panels._step_path_resolver import get_step_output_path, resolve_step_widget, resolve_subdir from PyQt5.QtWidgets import ( QWidget, QVBoxLayout, QGroupBox, QFormLayout, QGridLayout, diff --git a/src/gui/water_quality_gui_v2.py b/src/gui/water_quality_gui_v2.py index 51ae36e..b12eab3 100644 --- a/src/gui/water_quality_gui_v2.py +++ b/src/gui/water_quality_gui_v2.py @@ -482,22 +482,20 @@ class WaterQualityGUI(QMainWindow): QMessageBox.critical(self, "面板加载失败", f"加载页面时发生严重错误:\n{e}\n\n详见终端日志。") - # ====== 新增:状态回滚(解决幽灵跳转/假死) ====== - # 既然右侧未能成功切换,必须强制将左侧导航栏的选中项退回到与右侧一致 + # ====== 终极状态回滚机制 ====== self._step_list.blockSignals(True) try: current_tab_idx = self._tab_widget.currentIndex() - from src.gui.core.panel_registry import get_tab_index - # 遍历左侧列表,找到属于当前显示的 tab_index 的那个 step - for i in range(self._step_list.count()): - item_node = self._step_list.item(i) - if item_node: - node_data = item_node.data(Qt.UserRole) - if node_data and node_data != "stage_header" and get_tab_index(node_data) == current_tab_idx: + from src.gui.core.panel_registry import PANEL_REGISTRY + if 0 <= current_tab_idx < len(PANEL_REGISTRY): + correct_step_id = PANEL_REGISTRY[current_tab_idx]['step_id'] + for i in range(self._step_list.count()): + item_node = self._step_list.item(i) + if item_node and item_node.data(Qt.UserRole) == correct_step_id: self._step_list.setCurrentRow(i) break except Exception: - pass # 回滚期间如果发生异常,默默忽略,防止二次崩溃 + pass finally: self._step_list.blockSignals(False)