From 0c09cee8287e5e10077ed51fb4547bd8767588a9 Mon Sep 17 00:00:00 2001 From: Yorusora Date: Wed, 4 Jun 2025 22:12:32 +0800 Subject: [PATCH] =?UTF-8?q?1=E3=80=81=E4=BF=AE=E5=A4=8D=E4=BA=86<=E6=95=B0?= =?UTF-8?q?=E6=8D=AE=E7=B2=97=E5=90=8C=E6=AD=A5>=E4=B8=AD=EF=BC=8C?= =?UTF-8?q?=E8=BE=93=E5=85=A5=E6=88=AA=E6=96=AD=E4=BD=8D=E7=BD=AE=E5=89=8D?= =?UTF-8?q?=E7=AB=AF=EF=BC=88=5FPre=EF=BC=89=E5=A4=A7=E4=BA=8E=E4=BF=A1?= =?UTF-8?q?=E5=8F=B7=E9=95=BF=E5=BA=A6-=E5=90=8E=E7=AB=AF=EF=BC=88=5FPost?= =?UTF-8?q?=EF=BC=89=E6=97=B6=EF=BC=8C=E7=B3=BB=E7=BB=9F=E6=9C=AA=E6=AD=A3?= =?UTF-8?q?=E7=A1=AE=E6=A0=A1=E9=AA=8C=E5=B9=B6=E5=BC=B9=E7=AA=97=E6=8F=90?= =?UTF-8?q?=E7=A4=BA=E9=94=99=E8=AF=AF=EF=BC=8C=E5=AF=BC=E8=87=B4=E5=BA=94?= =?UTF-8?q?=E7=94=A8=E6=93=8D=E4=BD=9C=E5=A4=B1=E8=B4=A5=E7=9A=84=E9=97=AE?= =?UTF-8?q?=E9=A2=98?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- func/Module_approximately_align.py | 23 +++++++++++++++-------- func/utils/Constants.py | 2 ++ 2 files changed, 17 insertions(+), 8 deletions(-) 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": "(处理异常)",