优化了部分代码结构;

修改了复选框的样式
This commit is contained in:
Yorusora
2025-06-11 11:09:48 +08:00
parent 3c60f769ca
commit 8010d7c250
7 changed files with 53 additions and 66 deletions

View File

@ -365,6 +365,21 @@ class MainWindow(QMainWindow, Ui_Signal_Label):
path.mkdir(parents=True, exist_ok=True)
def set_dark_mode_status(self):
module_list = [
self,
self.approximately_align,
self.preprocess,
self.detect_Jpeak,
self.detect_Rpeak,
self.label_check,
self.precisely_align,
self.cut_PSG,
self.artifact_label,
self.bcg_quality_label,
self.resp_quality_label,
self.SA_label
]
try:
if self.ui.checkBox_darkmode.isChecked():
QApplication.styleHints().setColorScheme(Qt.ColorScheme.Dark)
@ -374,65 +389,12 @@ class MainWindow(QMainWindow, Ui_Signal_Label):
PublicFunc.msgbox_output(self, Constants.MAINWINDOW_DARKMODE_FAILURE + "" + format_exc(), Constants.MSGBOX_TYPE_ERROR)
return
try:
MainWindow.update_widget_style(self)
except RuntimeError:
pass
try:
if self.approximately_align is not None:
MainWindow.update_widget_style(self.approximately_align)
except RuntimeError:
pass
try:
if self.preprocess is not None:
MainWindow.update_widget_style(self.preprocess)
except RuntimeError:
pass
try:
if self.detect_Jpeak is not None:
MainWindow.update_widget_style(self.detect_Jpeak)
except RuntimeError:
pass
try:
if self.detect_Rpeak is not None:
MainWindow.update_widget_style(self.detect_Rpeak)
except RuntimeError:
pass
try:
if self.label_check is not None:
MainWindow.update_widget_style(self.label_check)
except RuntimeError:
pass
try:
if self.precisely_align is not None:
MainWindow.update_widget_style(self.precisely_align)
except RuntimeError:
pass
try:
if self.cut_PSG is not None:
MainWindow.update_widget_style(self.cut_PSG)
except RuntimeError:
pass
try:
if self.artifact_label is not None:
MainWindow.update_widget_style(self.artifact_label)
except RuntimeError:
pass
try:
if self.bcg_quality_label is not None:
MainWindow.update_widget_style(self.bcg_quality_label)
except RuntimeError:
pass
try:
if self.resp_quality_label is not None:
MainWindow.update_widget_style(self.resp_quality_label)
except RuntimeError:
pass
try:
if self.SA_label is not None:
MainWindow.update_widget_style(self.SA_label)
except RuntimeError:
pass
for module in module_list:
try:
if module is not None:
MainWindow.update_widget_style(module)
except RuntimeError:
pass
@staticmethod
def update_widget_style(mainWindow):