From 15bccb2da10f6f415a6c34c8d752c6440cbd0d77 Mon Sep 17 00:00:00 2001 From: Yorusora <2023025086@m.scnu.edu.cn> Date: Tue, 10 Jun 2025 19:45:08 +0800 Subject: [PATCH] =?UTF-8?q?=E4=BC=98=E5=8C=96=E4=BA=86=E6=89=80=E6=9C=89?= =?UTF-8?q?=E6=8C=89=E9=92=AE=E7=9A=84=E7=82=B9=E5=87=BB=E4=BD=93=E9=AA=8C?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- func/Module_SA_label.py | 1 + func/Module_approximately_align.py | 1 + func/Module_artifact_label.py | 1 + func/Module_bcg_quality_label.py | 1 + func/Module_cut_PSG.py | 1 + func/Module_detect_Jpeak.py | 1 + func/Module_detect_Rpeak.py | 1 + func/Module_label_check.py | 1 + func/Module_mainwindow.py | 43 ++++++++++++++++++++++++++++++ func/Module_precisely_align.py | 1 + func/Module_preprocess.py | 1 + func/Module_resp_quality_label.py | 1 + func/utils/Constants.py | 2 +- func/utils/PublicFunc.py | 11 ++++++++ 14 files changed, 66 insertions(+), 1 deletion(-) diff --git a/func/Module_SA_label.py b/func/Module_SA_label.py index dd449ab..486e2b0 100644 --- a/func/Module_SA_label.py +++ b/func/Module_SA_label.py @@ -323,6 +323,7 @@ class MainWindow_SA_label(QMainWindow): self.gs = None self.ui.textBrowser_info.setStyleSheet("QTextBrowser { background-color: rgb(255, 255, 200); }") + PublicFunc.__styleAllButton__(self, ButtonState) # 设定事件和其对应颜色 # event_code color event diff --git a/func/Module_approximately_align.py b/func/Module_approximately_align.py index 4ac8166..a65dd62 100644 --- a/func/Module_approximately_align.py +++ b/func/Module_approximately_align.py @@ -252,6 +252,7 @@ class MainWindow_approximately_align(QMainWindow): self.canvas = None self.ui.textBrowser_info.setStyleSheet("QTextBrowser { background-color: rgb(255, 255, 200); }") + PublicFunc.__styleAllButton__(self, ButtonState) self.msgBox = QMessageBox() self.msgBox.setWindowTitle(Constants.MAINWINDOW_MSGBOX_TITLE) diff --git a/func/Module_artifact_label.py b/func/Module_artifact_label.py index a492cbc..b4032b1 100644 --- a/func/Module_artifact_label.py +++ b/func/Module_artifact_label.py @@ -229,6 +229,7 @@ class MainWindow_artifact_label(QMainWindow): }) self.ui.textBrowser_info.setStyleSheet("QTextBrowser { background-color: rgb(255, 255, 200); }") + PublicFunc.__styleAllButton__(self, ButtonState) self.msgBox = QMessageBox() self.msgBox.setWindowTitle(Constants.MAINWINDOW_MSGBOX_TITLE) diff --git a/func/Module_bcg_quality_label.py b/func/Module_bcg_quality_label.py index b19046c..dbb915a 100644 --- a/func/Module_bcg_quality_label.py +++ b/func/Module_bcg_quality_label.py @@ -195,6 +195,7 @@ class MainWindow_bcg_quality_label(QMainWindow): self.line_data = None self.ui.textBrowser_info.setStyleSheet("QTextBrowser { background-color: rgb(255, 255, 200); }") + PublicFunc.__styleAllButton__(self, ButtonState) self.msgBox = QMessageBox() self.msgBox.setWindowTitle(Constants.MAINWINDOW_MSGBOX_TITLE) diff --git a/func/Module_cut_PSG.py b/func/Module_cut_PSG.py index ea54b8b..882f241 100644 --- a/func/Module_cut_PSG.py +++ b/func/Module_cut_PSG.py @@ -47,6 +47,7 @@ class MainWindow_cut_PSG(QMainWindow): self.data = None self.ui.textBrowser_info.setStyleSheet("QTextBrowser { background-color: rgb(255, 255, 200); }") + PublicFunc.__styleAllButton__(self, ButtonState) # 初始化进度条 self.ui.progressbar.setStyleSheet(Constants.PROGRESSBAR_STYLE) diff --git a/func/Module_detect_Jpeak.py b/func/Module_detect_Jpeak.py index 08aae69..a187ac6 100644 --- a/func/Module_detect_Jpeak.py +++ b/func/Module_detect_Jpeak.py @@ -157,6 +157,7 @@ class MainWindow_detect_Jpeak(QMainWindow): self.ax0 = None self.ui.textBrowser_info.setStyleSheet("QTextBrowser { background-color: rgb(255, 255, 200); }") + PublicFunc.__styleAllButton__(self, ButtonState) self.msgBox = QMessageBox() self.msgBox.setWindowTitle(Constants.MAINWINDOW_MSGBOX_TITLE) diff --git a/func/Module_detect_Rpeak.py b/func/Module_detect_Rpeak.py index 35dc6e7..7f8f530 100644 --- a/func/Module_detect_Rpeak.py +++ b/func/Module_detect_Rpeak.py @@ -155,6 +155,7 @@ class MainWindow_detect_Rpeak(QMainWindow): self.ax1 = None self.ui.textBrowser_info.setStyleSheet("QTextBrowser { background-color: rgb(255, 255, 200); }") + PublicFunc.__styleAllButton__(self, ButtonState) self.msgBox = QMessageBox() self.msgBox.setWindowTitle(Constants.MAINWINDOW_MSGBOX_TITLE) diff --git a/func/Module_label_check.py b/func/Module_label_check.py index f434040..afca9da 100644 --- a/func/Module_label_check.py +++ b/func/Module_label_check.py @@ -250,6 +250,7 @@ class MainWindow_label_check(QMainWindow): self.annotation_tableWidget = None self.ui.textBrowser_info.setStyleSheet("QTextBrowser { background-color: rgb(255, 255, 200); }") + PublicFunc.__styleAllButton__(self, ButtonState) # 初始化自动播放定时器 self.autoplay_xlim_start = None diff --git a/func/Module_mainwindow.py b/func/Module_mainwindow.py index 9fb1591..4c916de 100644 --- a/func/Module_mainwindow.py +++ b/func/Module_mainwindow.py @@ -25,12 +25,53 @@ from func.utils.Constants import Constants use("QtAgg") +# style.use('dark_background') + +# rcParams.update({ +# 'figure.facecolor': '#f5f5dc', +# 'axes.facecolor': '#f5f5dc' +# }) Config = { } +ButtonState = { + "Default": { + "pushButton_open": True, + "pushButton_approximately_align": True, + "pushButton_preprocess_BCG": True, + "pushButton_preprocess_ECG": True, + "pushButton_detect_Jpeak": True, + "pushButton_detect_Rpeak": True, + "pushButton_label_check_BCG": True, + "pushButton_label_check_ECG": True, + "pushButton_precisely_align": True, + "pushButton_cut_PSG": True, + "pushButton_artifact_label": True, + "pushButton_bcg_quality_label": True, + "pushButton_resp_quality_label": True, + "pushButton_SA_label": True + }, + "Current": { + "pushButton_open": True, + "pushButton_approximately_align": True, + "pushButton_preprocess_BCG": True, + "pushButton_preprocess_ECG": True, + "pushButton_detect_Jpeak": True, + "pushButton_detect_Rpeak": True, + "pushButton_label_check_BCG": True, + "pushButton_label_check_ECG": True, + "pushButton_precisely_align": True, + "pushButton_cut_PSG": True, + "pushButton_artifact_label": True, + "pushButton_bcg_quality_label": True, + "pushButton_resp_quality_label": True, + "pushButton_SA_label": True + } +} + class MainWindow(QMainWindow, Ui_Signal_Label): @@ -69,6 +110,8 @@ class MainWindow(QMainWindow, Ui_Signal_Label): self.resp_quality_label = None self.SA_label = None + PublicFunc.__styleAllButton__(self, ButtonState) + # 绑定槽函数 self.ui.pushButton_open.clicked.connect(self.__slot_btn_open__) self.ui.pushButton_approximately_align.clicked.connect(self.__slot_btn_approximately_align__) diff --git a/func/Module_precisely_align.py b/func/Module_precisely_align.py index 56b35b4..890bfa2 100644 --- a/func/Module_precisely_align.py +++ b/func/Module_precisely_align.py @@ -347,6 +347,7 @@ class MainWindow_precisely_align(QMainWindow): self.ax4_ylime = None self.ui.textBrowser_info.setStyleSheet("QTextBrowser { background-color: rgb(255, 255, 200); }") + PublicFunc.__styleAllButton__(self, ButtonState) self.msgBox = QMessageBox() self.msgBox.setWindowTitle(Constants.MAINWINDOW_MSGBOX_TITLE) diff --git a/func/Module_preprocess.py b/func/Module_preprocess.py index 1dc48ac..ad4348d 100644 --- a/func/Module_preprocess.py +++ b/func/Module_preprocess.py @@ -192,6 +192,7 @@ class MainWindow_preprocess(QMainWindow): self.ax0 = None self.ui.textBrowser_info.setStyleSheet("QTextBrowser { background-color: rgb(255, 255, 200); }") + PublicFunc.__styleAllButton__(self, ButtonState) self.msgBox = QMessageBox() self.msgBox.setWindowTitle(Constants.MAINWINDOW_MSGBOX_TITLE) diff --git a/func/Module_resp_quality_label.py b/func/Module_resp_quality_label.py index b46b471..cf5b633 100644 --- a/func/Module_resp_quality_label.py +++ b/func/Module_resp_quality_label.py @@ -226,6 +226,7 @@ class MainWindow_resp_quality_label(QMainWindow): self.cid2 = None self.ui.textBrowser_info.setStyleSheet("QTextBrowser { background-color: rgb(255, 255, 200); }") + PublicFunc.__styleAllButton__(self, ButtonState) self.msgBox = QMessageBox() self.msgBox.setWindowTitle(Constants.MAINWINDOW_MSGBOX_TITLE) diff --git a/func/utils/Constants.py b/func/utils/Constants.py index 05126ce..3885939 100644 --- a/func/utils/Constants.py +++ b/func/utils/Constants.py @@ -79,7 +79,7 @@ class Constants: color: black; text-align: center; height: 20px; - background: #E5E4E4; + background: rgba(245, 245, 220, 128); } QProgressBar::chunk { background: qlineargradient(x1:0, y1:0, x2:1, y2:0, stop:0 #9AFF99, stop:1 #9A9AFE); diff --git a/func/utils/PublicFunc.py b/func/utils/PublicFunc.py index 277a89f..8945b48 100644 --- a/func/utils/PublicFunc.py +++ b/func/utils/PublicFunc.py @@ -142,6 +142,17 @@ class PublicFunc: if widget.objectName() in buttonState["Default"].keys(): widget.setEnabled(buttonState["Default"][widget.objectName()]) + @staticmethod + def __styleAllButton__(mainWindow, buttonState): + # 启用按钮 + all_widgets = mainWindow.centralWidget().findChildren(QWidget) + + # 迭代所有部件,查找按钮并启用它们 + for widget in all_widgets: + if isinstance(widget, QPushButton): + if widget.objectName() in buttonState["Default"].keys(): + widget.setStyleSheet(Constants.LABELBTN_STYLE_NORMAL) + @staticmethod def add_progressbar(mainWindow): mainWindow.progressbar = QProgressBar()