修改了文件命名规则

This commit is contained in:
Yorusora
2025-05-19 17:21:27 +08:00
parent 3511b94c28
commit 55d5df3fb6
4 changed files with 140 additions and 76 deletions

View File

@ -1,6 +1,7 @@
from pathlib import Path
from PySide6.QtWidgets import QMainWindow, QMessageBox, QFileDialog
from PySide6.QtGui import QGuiApplication
from matplotlib import use
from yaml import dump, load, FullLoader
@ -15,6 +16,7 @@ from func.Module_label_check import MainWindow_label_check
from func.Module_precisely_align import MainWindow_precisely_align
from func.Module_cut_PSG import MainWindow_cut_PSG
from func.Module_artifact_label import MainWindow_artifact_label
from func.Module_SA_label import MainWindow_SA_label
from func.utils.Constants import Constants, ConfigParams
@ -34,7 +36,15 @@ class MainWindow(QMainWindow, Ui_Signal_Label):
self.ui = Ui_Signal_Label()
self.ui.setupUi(self)
self.setFixedSize(720, 1080) # 设置固定大小,禁止缩放
# self.setFixedSize(720, 1080) # 设置固定大小,禁止缩放
# 获得屏幕分辨率以34比例设置窗口大小
screen = QGuiApplication.primaryScreen()
size = screen.availableGeometry()
screen_height = size.height()
window_height = int(screen_height * 0.75)
window_width = int(window_height * 1 / 2)
self.resize(window_width, window_height)
# 消息弹窗初始化
self.msgBox = QMessageBox()
@ -53,6 +63,8 @@ class MainWindow(QMainWindow, Ui_Signal_Label):
self.cut_PSG = None
self.artifact_label = None
self.SA_label = None
# 绑定槽函数
self.ui.pushButton_open.clicked.connect(self.__slot_btn_open__)
self.ui.pushButton_approximately_align.clicked.connect(self.__slot_btn_approximately_align__)
@ -65,6 +77,7 @@ class MainWindow(QMainWindow, Ui_Signal_Label):
self.ui.pushButton_precisely_align.clicked.connect(self.__slot_btn_precisely_align__)
self.ui.pushButton_cut_PSG.clicked.connect(self.__slot_btn_cut_PSG__)
self.ui.pushButton_artifact_label.clicked.connect(self.__slot_btn_artifact_label__)
self.ui.pushButton_SA_label.clicked.connect(self.__slot_btn_SA_label__)
@staticmethod
def __read_config__():
@ -105,6 +118,8 @@ class MainWindow(QMainWindow, Ui_Signal_Label):
if not self.check_sampID():
return
self.approximately_align.show(root_path, int(sampID))
# 默认最大化显示而非固定分辨率
self.approximately_align.showMaximized()
def __slot_btn_preprocess__(self):
self.preprocess = MainWindow_preprocess()
@ -123,6 +138,8 @@ class MainWindow(QMainWindow, Ui_Signal_Label):
if not self.check_sampID():
return
self.preprocess.show(mode, root_path, int(sampID))
# 默认最大化显示而非固定分辨率
self.preprocess.showMaximized()
def __slot_btn_detect_Jpeak__(self):
self.detect_Jpeak = MainWindow_detect_Jpeak()
@ -133,6 +150,8 @@ class MainWindow(QMainWindow, Ui_Signal_Label):
if not self.check_sampID():
return
self.detect_Jpeak.show(root_path, int(sampID))
# 默认最大化显示而非固定分辨率
self.detect_Jpeak.showMaximized()
def __slot_btn_detect_Rpeak__(self):
self.detect_Rpeak = MainWindow_detect_Rpeak()
@ -143,6 +162,8 @@ class MainWindow(QMainWindow, Ui_Signal_Label):
if not self.check_sampID():
return
self.detect_Rpeak.show(root_path, int(sampID))
# 默认最大化显示而非固定分辨率
self.detect_Rpeak.showMaximized()
def __slot_btn_label_check__(self):
self.label_check = MainWindow_label_check()
@ -163,6 +184,9 @@ class MainWindow(QMainWindow, Ui_Signal_Label):
else:
raise ValueError("模式不存在")
self.label_check.show(mode, root_path, int(sampID))
# 默认最大化显示而非固定分辨率
self.label_check.showMaximized()
def __slot_btn_precisely_align__(self):
self.precisely_align = MainWindow_precisely_align()
@ -173,6 +197,8 @@ class MainWindow(QMainWindow, Ui_Signal_Label):
if not self.check_sampID():
return
self.precisely_align.show(root_path, int(sampID))
# 默认最大化显示而非固定分辨率
self.precisely_align.showMaximized()
def __slot_btn_cut_PSG__(self):
self.cut_PSG = MainWindow_cut_PSG()
@ -183,6 +209,8 @@ class MainWindow(QMainWindow, Ui_Signal_Label):
if not self.check_sampID():
return
self.cut_PSG.show(root_path, int(sampID))
# 默认最大化显示而非固定分辨率
self.cut_PSG.showMaximized()
def __slot_btn_artifact_label__(self):
self.artifact_label = MainWindow_artifact_label()
@ -193,6 +221,12 @@ class MainWindow(QMainWindow, Ui_Signal_Label):
if not self.check_sampID():
return
self.artifact_label.show(root_path, int(sampID))
# 默认最大化显示而非固定分辨率
self.artifact_label.showMaximized()
def __slot_btn_SA_label__(self):
self.SA_label = MainWindow_SA_label()
self.SA_label.show()
def seek_sampID(self, path):
if not Path(path).exists():
@ -202,6 +236,7 @@ class MainWindow(QMainWindow, Ui_Signal_Label):
sub_folders = [item.name for item in Path(path).iterdir() if item.is_dir()]
self.ui.comboBox_sampID.addItems(sub_folders)
def check_root_path(self):
if self.ui.plainTextEdit_root_path.toPlainText() == Constants.STRING_IS_EMPTY:
PublicFunc.msgbox_output(self, Constants.MAINWINDOW_ROOT_PATH_NOT_EXIST, Constants.MSGBOX_TYPE_ERROR)