优化了所有按钮的点击体验
This commit is contained in:
@ -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
|
||||
|
||||
@ -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)
|
||||
|
||||
@ -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)
|
||||
|
||||
@ -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)
|
||||
|
||||
@ -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)
|
||||
|
||||
@ -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)
|
||||
|
||||
@ -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)
|
||||
|
||||
@ -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
|
||||
|
||||
@ -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__)
|
||||
|
||||
@ -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)
|
||||
|
||||
@ -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)
|
||||
|
||||
@ -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)
|
||||
|
||||
@ -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);
|
||||
|
||||
@ -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()
|
||||
|
||||
Reference in New Issue
Block a user