diff --git a/func/Module_approximately_align.py b/func/Module_approximately_align.py index 781e6af..3482505 100644 --- a/func/Module_approximately_align.py +++ b/func/Module_approximately_align.py @@ -478,15 +478,22 @@ class MainWindow_approximately_align(QMainWindow): def __slot_btn_CutOff__(self): PublicFunc.__disableAllButton__(self, ButtonState) - Config["orgBcgConfig"].update({"PreA": self.ui.spinBox_orgBcgPreA.value(), - "PreCut": self.ui.spinBox_orgBcgPreCut.value(), - "PostCut": self.ui.spinBox_orgBcgPostCut.value()}) - Config["PSGConfig"].update({"PreA": self.ui.spinBox_PSGPreA.value(), - "PreCut": self.ui.spinBox_PSGPreCut.value(), - "PostCut": self.ui.spinBox_PSGPostCut.value()}) + if self.ui.spinBox_orgBcgPreA.value() + self.ui.spinBox_orgBcgPostCut.value() >= len(self.data.processed_downsample_orgBcg): + result = Result().failure( + info=Constants.OPERATION_FAILURE + Constants.FAILURE_REASON["OrgBCG_Cut_Length_Not_Correct"]) + elif self.ui.spinBox_PSGPreCut.value() + self.ui.spinBox_PSGPostCut.value() >= len(self.data.processed_downsample_Tho): + result = Result().failure( + info=Constants.OPERATION_FAILURE + Constants.FAILURE_REASON["PSG_Cut_Length_Not_Correct"]) + else: + Config["orgBcgConfig"].update({"PreA": self.ui.spinBox_orgBcgPreA.value(), + "PreCut": self.ui.spinBox_orgBcgPreCut.value(), + "PostCut": self.ui.spinBox_orgBcgPostCut.value()}) + Config["PSGConfig"].update({"PreA": self.ui.spinBox_PSGPreA.value(), + "PreCut": self.ui.spinBox_PSGPreCut.value(), + "PostCut": self.ui.spinBox_PSGPostCut.value()}) - PublicFunc.progressbar_update(self, 1, 1, Constants.DRAWING_DATA, 0) - result = self.__plot__() + PublicFunc.progressbar_update(self, 1, 1, Constants.DRAWING_DATA, 0) + result = self.__plot__() if not result.status: PublicFunc.text_output(self.ui, "(1/1)" + result.info, Constants.TIPS_TYPE_ERROR) diff --git a/func/utils/Constants.py b/func/utils/Constants.py index c6f3c3b..20367c4 100644 --- a/func/utils/Constants.py +++ b/func/utils/Constants.py @@ -110,6 +110,8 @@ class Constants: "Interval_Args_Not_Correct": "(间期参数输入不正确,上间期阈值应大于下间期阈值)", "Save_Permission_Denied": "(所保存的文件正在被其他进程使用)", "Save_File_Not_Found": "(保存路径不存在)", + "OrgBCG_Cut_Length_Not_Correct": "(OrgBCG的切割长度不正确,Pre+Post长度大于信号长度)", + "PSG_Cut_Length_Not_Correct": "(PSG的切割长度不正确,Pre+Post长度大于信号长度)", "Open_Data_Exception": "(打开数据异常)", "Process_Exception": "(处理异常)",