步骤四页面修改
This commit is contained in:
@ -1,14 +1,13 @@
|
||||
#!/usr/bin/env python
|
||||
# -*- coding: utf-8 -*-
|
||||
"""
|
||||
Step4 面板 - 采样点布设 (现代化排版重构)
|
||||
Step4 面板 - 采样点布设 (已移除“启用此步骤”)
|
||||
"""
|
||||
|
||||
import os
|
||||
import sys
|
||||
from pathlib import Path
|
||||
|
||||
# 路径归一化 helper
|
||||
_HERE = os.path.dirname(os.path.abspath(__file__))
|
||||
if _HERE not in sys.path:
|
||||
sys.path.insert(0, _HERE)
|
||||
@ -17,7 +16,7 @@ from _step_path_resolver import resolve_subdir
|
||||
from PyQt5.QtCore import QTimer, Qt
|
||||
from PyQt5.QtWidgets import (
|
||||
QWidget, QVBoxLayout, QHBoxLayout, QGroupBox, QFormLayout,
|
||||
QPushButton, QCheckBox, QSpinBox, QMessageBox, QLabel, QFrame
|
||||
QPushButton, QSpinBox, QMessageBox, QLabel, QFrame
|
||||
)
|
||||
|
||||
from src.gui.components.custom_widgets import FileSelectWidget
|
||||
@ -26,24 +25,17 @@ from src.gui.styles import ModernStylesheet
|
||||
|
||||
|
||||
class Step4SamplingPanel(QWidget):
|
||||
"""步骤4:采样点布设"""
|
||||
|
||||
def __init__(self, parent=None):
|
||||
super().__init__(parent)
|
||||
self.init_ui()
|
||||
|
||||
def init_ui(self):
|
||||
# 注入全局样式系统
|
||||
self.setStyleSheet(ModernStylesheet.get_main_stylesheet())
|
||||
|
||||
# 主布局:增加四周留白(24px)和模块间的呼吸间距(20px)
|
||||
main_layout = QVBoxLayout()
|
||||
main_layout.setContentsMargins(24, 24, 24, 24)
|
||||
main_layout.setSpacing(20)
|
||||
|
||||
# ==========================================
|
||||
# 卡片 1:输入数据配置
|
||||
# ==========================================
|
||||
input_group = QGroupBox("📁 输入数据")
|
||||
input_layout = QVBoxLayout()
|
||||
input_layout.setSpacing(16)
|
||||
@ -62,9 +54,6 @@ class Step4SamplingPanel(QWidget):
|
||||
input_group.setLayout(input_layout)
|
||||
main_layout.addWidget(input_group)
|
||||
|
||||
# ==========================================
|
||||
# 卡片 2:核心参数设置
|
||||
# ==========================================
|
||||
params_group = QGroupBox("⚙️ 采样参数")
|
||||
params_layout = QFormLayout()
|
||||
params_layout.setSpacing(16)
|
||||
@ -91,6 +80,7 @@ class Step4SamplingPanel(QWidget):
|
||||
self.chunk_size.setMinimumWidth(120)
|
||||
params_layout.addRow("内存处理块大小:", self.chunk_size)
|
||||
|
||||
from PyQt5.QtWidgets import QCheckBox
|
||||
self.use_adaptive_sampling = QCheckBox("启用自适应边缘采样")
|
||||
self.use_adaptive_sampling.setChecked(True)
|
||||
params_layout.addRow("智能模式:", self.use_adaptive_sampling)
|
||||
@ -98,15 +88,11 @@ class Step4SamplingPanel(QWidget):
|
||||
params_group.setLayout(params_layout)
|
||||
main_layout.addWidget(params_group)
|
||||
|
||||
# ==========================================
|
||||
# 卡片 3:输出与执行
|
||||
# ==========================================
|
||||
output_group = QGroupBox("🚀 输出与执行")
|
||||
output_layout = QVBoxLayout()
|
||||
output_layout.setSpacing(16)
|
||||
output_layout.setContentsMargins(20, 24, 20, 20)
|
||||
|
||||
# 输出文件选择
|
||||
self.output_file = FileSelectWidget(
|
||||
"结果保存至:",
|
||||
"CSV Files (*.csv);;All Files (*.*)",
|
||||
@ -115,14 +101,8 @@ class Step4SamplingPanel(QWidget):
|
||||
self.output_file.line_edit.setPlaceholderText("sampling_spectra.csv")
|
||||
output_layout.addWidget(self.output_file)
|
||||
|
||||
# 底部操作栏 (水平布局)
|
||||
action_layout = QHBoxLayout()
|
||||
|
||||
self.enable_checkbox = QCheckBox("启用此步骤")
|
||||
self.enable_checkbox.setChecked(True)
|
||||
action_layout.addWidget(self.enable_checkbox)
|
||||
|
||||
action_layout.addStretch() # 把按钮推到右边
|
||||
action_layout.addStretch()
|
||||
|
||||
self.preview_btn = QPushButton("交互式预览采样点")
|
||||
self.preview_btn.setStyleSheet(ModernStylesheet.get_button_stylesheet('normal'))
|
||||
@ -145,15 +125,12 @@ class Step4SamplingPanel(QWidget):
|
||||
main_layout.addStretch()
|
||||
self.setLayout(main_layout)
|
||||
|
||||
# 添加心跳定时器
|
||||
self._status_timer = QTimer(self)
|
||||
self._status_timer.timeout.connect(self._check_csv_exists)
|
||||
self._status_timer.start(2000)
|
||||
|
||||
# 监听输出路径变化
|
||||
self.output_file.line_edit.textChanged.connect(self._on_output_changed)
|
||||
|
||||
# ================= 下方业务逻辑保持不变 =================
|
||||
def get_config(self):
|
||||
config = {
|
||||
'interval': self.interval.value(),
|
||||
|
||||
Reference in New Issue
Block a user