Merge branch 'master' into cxh_dev

This commit is contained in:
marques
2025-06-11 10:12:23 +08:00
21 changed files with 466 additions and 166 deletions

View File

@ -322,6 +322,9 @@ class MainWindow_SA_label(QMainWindow):
self.figToolbar = None
self.gs = None
self.ui.textBrowser_info.setStyleSheet("QTextBrowser { background-color: rgb(255, 255, 200); }")
PublicFunc.__styleAllButton__(self, ButtonState)
# 设定事件和其对应颜色
# event_code color event
# 0 黑色 背景
@ -479,6 +482,7 @@ class MainWindow_SA_label(QMainWindow):
self.ax6.clear()
# 释放资源
self.setting.close()
del self.data
self.fig.clf()
plt.close(self.fig)
@ -498,19 +502,12 @@ class MainWindow_SA_label(QMainWindow):
sender = self.sender()
if sender == self.ui.pushButton_input:
try:
self.draw_one_event()
self.canvas.draw()
except Exception as e:
return Result().failure(info=Constants.DRAW_FAILURE + "\n" + format_exc())
elif sender == self.ui.tableWidget_label or sender == self.ui.tableWidget_label_add:
try:
self.draw_one_event()
self.canvas.draw()
except Exception as e:
return Result().failure(info=Constants.DRAW_FAILURE + "\n" + format_exc())
elif sender == self.ui.pushButton_prev or sender == self.ui.pushButton_next:
if (sender == self.ui.pushButton_input or
sender == self.ui.tableWidget_label or
sender == self.ui.tableWidget_label_add or
sender == self.ui.pushButton_prev or
sender == self.ui.pushButton_next or
sender == self.figToolbar.action_Reset_Signal_and_Time):
try:
self.draw_one_event()
self.canvas.draw()
@ -529,8 +526,6 @@ class MainWindow_SA_label(QMainWindow):
return Result().failure(info=Constants.DRAW_FAILURE + "\n" + format_exc())
return Result().success(info=Constants.DRAW_FINISHED)
def update_UI_Args(self):
try:
if self.data is not None and self.data.df_corrected is not None:
@ -628,11 +623,10 @@ class MainWindow_SA_label(QMainWindow):
if str(remark) != "" and str(remark) != "nan" and row.get("isLabeled", None) == 1:
for col in range(self.ui.tableWidget_label.columnCount()):
item = self.ui.tableWidget_label.item(index, col)
item.setBackground(QColor(255, 200, 200))
item.setBackground(QColor(255, 200, 200, 128))
else:
for col in range(self.ui.tableWidget_label.columnCount()):
item = self.ui.tableWidget_label.item(index, col)
item.setBackground(QColor(255, 255, 255))
if self.data.df_addNew is not None:
self.ui.tableWidget_label_add.setRowCount(len(self.data.df_addNew))
@ -675,11 +669,10 @@ class MainWindow_SA_label(QMainWindow):
if str(remark) != Constants.STRING_IS_EMPTY and str(remark) != Constants.STRING_IS_NAN and row.get("isLabeled", None) == 1:
for col in range(self.ui.tableWidget_label_add.columnCount()):
item = self.ui.tableWidget_label_add.item(index, col)
item.setBackground(QColor(255, 200, 200))
item.setBackground(QColor(255, 200, 200, 128))
else:
for col in range(self.ui.tableWidget_label_add.columnCount()):
item = self.ui.tableWidget_label_add.item(index, col)
item.setBackground(QColor(255, 255, 255))
except Exception as e:
return Result().failure(info=Constants.UPDATE_FAILURE +
Constants.FAILURE_REASON["Update_tableWidget_Exception"] + "\n" + format_exc())
@ -800,6 +793,7 @@ class MainWindow_SA_label(QMainWindow):
PublicFunc.msgbox_output(self, Constants.SA_LABEL_ALL_LABELED, Constants.MSGBOX_TYPE_INFO)
self.__reset__()
self.setting.close()
self.figToolbar.action_Reset_Signal_and_Time.setEnabled(True)
for action in self.figToolbar._actions.values():
action.setEnabled(True)
@ -1115,10 +1109,14 @@ class MainWindow_SA_label(QMainWindow):
PublicFunc.finish_operation(self, ButtonState)
def toggle_resetOriginalView(self):
self.figToolbar.home()
self.figToolbar.action_Reset_Signal_and_Time.setChecked(False)
self.ui.spinBox_correctStart.setValue(Config["BCG_SP"])
self.ui.spinBox_correctEnd.setValue(Config["BCG_EP"])
if self.ui.checkBox_examineBySecond.isChecked():
self.__plot__()
self.update_UI_Args()
else:
self.figToolbar.home()
self.figToolbar.action_Reset_Signal_and_Time.setChecked(False)
self.ui.spinBox_correctStart.setValue(Config["BCG_SP"])
self.ui.spinBox_correctEnd.setValue(Config["BCG_EP"])
def reset_axes(self):
if self.ax0 is not None: