优化了重置绘图的代码

This commit is contained in:
Yorusora
2025-05-22 09:50:03 +08:00
parent c9b5e35867
commit 85a69648e0
5 changed files with 71 additions and 48 deletions

View File

@ -1000,33 +1000,40 @@ class MainWindow_SA_label(QMainWindow):
self.ui.spinBox_correctEnd.setValue(Config["BCG_EP"]) self.ui.spinBox_correctEnd.setValue(Config["BCG_EP"])
def reset_axes(self): def reset_axes(self):
self.ax0.clear() if self.ax0 is not None:
self.ax1.clear() self.ax0.clear()
self.ax2.clear() self.ax0.grid(True)
self.ax3.clear() self.ax0.xaxis.set_major_formatter(ConfigParams.FORMATTER)
self.ax4.clear() self.ax0.tick_params(axis='x', colors=Constants.PLOT_COLOR_WHITE)
self.ax5.clear() if self.ax1 is not None:
self.ax6.clear() self.ax1.clear()
self.ax0.grid(True) self.ax1.grid(True)
self.ax0.xaxis.set_major_formatter(ConfigParams.FORMATTER) self.ax1.xaxis.set_major_formatter(ConfigParams.FORMATTER)
self.ax0.tick_params(axis='x', colors=Constants.PLOT_COLOR_WHITE) self.ax1.tick_params(axis='x', colors=Constants.PLOT_COLOR_WHITE)
self.ax1.grid(True) if self.ax2 is not None:
self.ax1.xaxis.set_major_formatter(ConfigParams.FORMATTER) self.ax2.clear()
self.ax1.tick_params(axis='x', colors=Constants.PLOT_COLOR_WHITE) self.ax2.grid(True)
self.ax2.grid(True) self.ax2.xaxis.set_major_formatter(ConfigParams.FORMATTER)
self.ax2.xaxis.set_major_formatter(ConfigParams.FORMATTER) self.ax2.tick_params(axis='x', colors=Constants.PLOT_COLOR_WHITE)
self.ax2.tick_params(axis='x', colors=Constants.PLOT_COLOR_WHITE) if self.ax3 is not None:
self.ax3.grid(True) self.ax3.clear()
self.ax3.xaxis.set_major_formatter(ConfigParams.FORMATTER) self.ax3.grid(True)
self.ax3.tick_params(axis='x', colors=Constants.PLOT_COLOR_WHITE) self.ax3.xaxis.set_major_formatter(ConfigParams.FORMATTER)
self.ax4.grid(True) self.ax3.tick_params(axis='x', colors=Constants.PLOT_COLOR_WHITE)
self.ax4.xaxis.set_major_formatter(ConfigParams.FORMATTER) if self.ax4 is not None:
self.ax4.tick_params(axis='x', colors=Constants.PLOT_COLOR_WHITE) self.ax4.clear()
self.ax5.grid(True) self.ax4.grid(True)
self.ax5.xaxis.set_major_formatter(ConfigParams.FORMATTER) self.ax4.xaxis.set_major_formatter(ConfigParams.FORMATTER)
self.ax5.tick_params(axis='x', colors=Constants.PLOT_COLOR_WHITE) self.ax4.tick_params(axis='x', colors=Constants.PLOT_COLOR_WHITE)
self.ax6.grid(True) if self.ax5 is not None:
self.ax6.xaxis.set_major_formatter(ConfigParams.FORMATTER) self.ax5.clear()
self.ax5.grid(True)
self.ax5.xaxis.set_major_formatter(ConfigParams.FORMATTER)
self.ax5.tick_params(axis='x', colors=Constants.PLOT_COLOR_WHITE)
if self.ax6 is not None:
self.ax6.clear()
self.ax6.grid(True)
self.ax6.xaxis.set_major_formatter(ConfigParams.FORMATTER)
def on_xlim_change(self, event_ax): def on_xlim_change(self, event_ax):
# 获取当前x轴范围 # 获取当前x轴范围

View File

@ -592,9 +592,6 @@ class MainWindow_artifact_label(QMainWindow):
else: else:
PublicFunc.text_output(self.ui, "(2/6)" + result.info, Constants.TIPS_TYPE_INFO) PublicFunc.text_output(self.ui, "(2/6)" + result.info, Constants.TIPS_TYPE_INFO)
self.__reset__()
PublicFunc.finish_operation(self, ButtonState)
# 获取存档 # 获取存档
PublicFunc.progressbar_update(self, 3, 6, Constants.LOADING_ARCHIVE, 50) PublicFunc.progressbar_update(self, 3, 6, Constants.LOADING_ARCHIVE, 50)
result = self.data.get_archive() result = self.data.get_archive()
@ -929,13 +926,15 @@ class MainWindow_artifact_label(QMainWindow):
PublicFunc.text_output(self.ui, f"{Constants.ARTIFACT_LABEL_JUMP_ARTIFACT}{str(self.pressed_number)}", Constants.TIPS_TYPE_INFO) PublicFunc.text_output(self.ui, f"{Constants.ARTIFACT_LABEL_JUMP_ARTIFACT}{str(self.pressed_number)}", Constants.TIPS_TYPE_INFO)
def reset_axes(self): def reset_axes(self):
self.ax0.clear() if self.ax0 is not None:
self.ax1.clear() self.ax0.clear()
self.ax0.grid(True) self.ax0.grid(True)
self.ax0.xaxis.set_major_formatter(ConfigParams.FORMATTER) self.ax0.xaxis.set_major_formatter(ConfigParams.FORMATTER)
self.ax0.tick_params(axis='x', colors=Constants.PLOT_COLOR_WHITE) self.ax0.tick_params(axis='x', colors=Constants.PLOT_COLOR_WHITE)
self.ax1.grid(True) if self.ax1 is not None:
self.ax1.xaxis.set_major_formatter(ConfigParams.FORMATTER) self.ax1.clear()
self.ax1.grid(True)
self.ax1.xaxis.set_major_formatter(ConfigParams.FORMATTER)
def on_xlim_change(self, event_ax): def on_xlim_change(self, event_ax):
try: try:

View File

@ -670,13 +670,15 @@ class MainWindow_label_check(QMainWindow):
PublicFunc.text_output(self.ui, f"{Constants.LABEL_CHECK_JUMP_X_INDEX}{str(int(x))}", Constants.TIPS_TYPE_INFO) PublicFunc.text_output(self.ui, f"{Constants.LABEL_CHECK_JUMP_X_INDEX}{str(int(x))}", Constants.TIPS_TYPE_INFO)
def reset_axes(self): def reset_axes(self):
self.ax0.clear() if self.ax0 is not None:
self.ax1.clear() self.ax0.clear()
self.ax0.grid(True) self.ax0.grid(True)
self.ax0.xaxis.set_major_formatter(ConfigParams.FORMATTER) self.ax0.xaxis.set_major_formatter(ConfigParams.FORMATTER)
self.ax0.tick_params(axis='x', colors=Constants.PLOT_COLOR_WHITE) self.ax0.tick_params(axis='x', colors=Constants.PLOT_COLOR_WHITE)
self.ax1.grid(True) if self.ax1 is not None:
self.ax1.xaxis.set_major_formatter(ConfigParams.FORMATTER) self.ax1.clear()
self.ax1.grid(True)
self.ax1.xaxis.set_major_formatter(ConfigParams.FORMATTER)
def on_xlim_change(self, event_ax): def on_xlim_change(self, event_ax):
try: try:

View File

@ -16,6 +16,7 @@ from func.Module_label_check import MainWindow_label_check
from func.Module_precisely_align import MainWindow_precisely_align from func.Module_precisely_align import MainWindow_precisely_align
from func.Module_cut_PSG import MainWindow_cut_PSG from func.Module_cut_PSG import MainWindow_cut_PSG
from func.Module_artifact_label import MainWindow_artifact_label from func.Module_artifact_label import MainWindow_artifact_label
from func.Module_resp_quality_label import MainWindow_resp_quality_label
from func.Module_SA_label import MainWindow_SA_label from func.Module_SA_label import MainWindow_SA_label
from func.utils.Constants import Constants, ConfigParams from func.utils.Constants import Constants, ConfigParams
@ -62,7 +63,7 @@ class MainWindow(QMainWindow, Ui_Signal_Label):
self.precisely_align = None self.precisely_align = None
self.cut_PSG = None self.cut_PSG = None
self.artifact_label = None self.artifact_label = None
self.resp_quality_label = None
self.SA_label = None self.SA_label = None
# 绑定槽函数 # 绑定槽函数
@ -77,6 +78,7 @@ class MainWindow(QMainWindow, Ui_Signal_Label):
self.ui.pushButton_precisely_align.clicked.connect(self.__slot_btn_precisely_align__) 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_cut_PSG.clicked.connect(self.__slot_btn_cut_PSG__)
self.ui.pushButton_artifact_label.clicked.connect(self.__slot_btn_artifact_label__) self.ui.pushButton_artifact_label.clicked.connect(self.__slot_btn_artifact_label__)
self.ui.pushButton_resp_quality_label.clicked.connect(self.__slot_btn_resp_quality_label__)
self.ui.pushButton_SA_label.clicked.connect(self.__slot_btn_SA_label__) self.ui.pushButton_SA_label.clicked.connect(self.__slot_btn_SA_label__)
@staticmethod @staticmethod
@ -222,6 +224,18 @@ class MainWindow(QMainWindow, Ui_Signal_Label):
# 默认最大化显示而非固定分辨率 # 默认最大化显示而非固定分辨率
self.artifact_label.showMaximized() self.artifact_label.showMaximized()
def __slot_btn_resp_quality_label__(self):
self.resp_quality_label = MainWindow_resp_quality_label()
root_path = self.ui.plainTextEdit_root_path.toPlainText()
sampID = self.ui.comboBox_sampID.currentText()
if not self.check_root_path():
return
if not self.check_sampID():
return
self.resp_quality_label.show(root_path, int(sampID))
# 默认最大化显示而非固定分辨率
self.resp_quality_label.showMaximized()
def __slot_btn_SA_label__(self): def __slot_btn_SA_label__(self):
self.SA_label = MainWindow_SA_label() self.SA_label = MainWindow_SA_label()
root_path = self.ui.plainTextEdit_root_path.toPlainText() root_path = self.ui.plainTextEdit_root_path.toPlainText()

View File

@ -385,9 +385,10 @@ class MainWindow_preprocess(QMainWindow):
PublicFunc.finish_operation(self, ButtonState) PublicFunc.finish_operation(self, ButtonState)
def reset_axes(self): def reset_axes(self):
self.ax0.clear() if self.ax0 is not None:
self.ax0.grid(True) self.ax0.clear()
self.ax0.xaxis.set_major_formatter(ConfigParams.FORMATTER) self.ax0.grid(True)
self.ax0.xaxis.set_major_formatter(ConfigParams.FORMATTER)
class Data: class Data: