修复了路径不存在时无法正确创建文件夹的问题
This commit is contained in:
@ -19,7 +19,7 @@
|
|||||||
|
|
||||||
6、<呼吸可用性及间期标注>的体动显示做一个和<BCG的质量标注>一样的可以根据勾选来显示需要显示的体动
|
6、<呼吸可用性及间期标注>的体动显示做一个和<BCG的质量标注>一样的可以根据勾选来显示需要显示的体动
|
||||||
|
|
||||||
7、各个模块中的检测父级文件夹是否存在的功能仍存在问题,无法正确创建文件夹
|
~~7、各个模块中的检测父级文件夹是否存在的功能仍存在问题,无法正确创建文件夹~~
|
||||||
|
|
||||||
## 1、主菜单
|
## 1、主菜单
|
||||||
|
|
||||||
|
|||||||
@ -1590,9 +1590,6 @@ class Data:
|
|||||||
return Result().success(info=Constants.RESAMPLE_FINISHED)
|
return Result().success(info=Constants.RESAMPLE_FINISHED)
|
||||||
|
|
||||||
def save(self):
|
def save(self):
|
||||||
if (not Path(Config["Path"]["Save"]).parent.exists()) or (not Path(Config["Path"]["Save"]).parent.is_dir()):
|
|
||||||
Path(Config["Path"]["Save"]).parent.mkdir(parents=True, exist_ok=True)
|
|
||||||
|
|
||||||
if self.df_corrected is None:
|
if self.df_corrected is None:
|
||||||
return Result().failure(info=Constants.SAVE_FAILURE + Constants.FAILURE_REASON["Data_Not_Exist"])
|
return Result().failure(info=Constants.SAVE_FAILURE + Constants.FAILURE_REASON["Data_Not_Exist"])
|
||||||
|
|
||||||
|
|||||||
@ -964,8 +964,6 @@ class Data:
|
|||||||
return Result().success(info=Constants.INPUT_FINISHED)
|
return Result().success(info=Constants.INPUT_FINISHED)
|
||||||
|
|
||||||
def save(self, epoch):
|
def save(self, epoch):
|
||||||
if (not Path(Config["Path"]["Save"]).parent.exists()) or (not Path(Config["Path"]["Save"]).parent.is_dir()):
|
|
||||||
Path(Config["Path"]["Save"]).parent.mkdir(parents=True, exist_ok=True)
|
|
||||||
try:
|
try:
|
||||||
pos = Config["pos"]
|
pos = Config["pos"]
|
||||||
ApplyFrequency = Config["ApplyFrequency"]
|
ApplyFrequency = Config["ApplyFrequency"]
|
||||||
|
|||||||
@ -1378,13 +1378,6 @@ class Data:
|
|||||||
return Result().success(info=Constants.ARCHIVE_EXIST)
|
return Result().success(info=Constants.ARCHIVE_EXIST)
|
||||||
|
|
||||||
def save(self, amount, duration):
|
def save(self, amount, duration):
|
||||||
if (not Path(Config["Path"]["Save_a"]).parent.exists()) or (not Path(Config["Path"]["Save_a"]).parent.is_dir()):
|
|
||||||
Path(Config["Path"]["Save_a"]).parent.mkdir(parents=True, exist_ok=True)
|
|
||||||
if (not Path(Config["Path"]["Save_b"]).parent.exists()) or (not Path(Config["Path"]["Save_b"]).parent.is_dir()):
|
|
||||||
Path(Config["Path"]["Save_b"]).parent.mkdir(parents=True, exist_ok=True)
|
|
||||||
if (not Path(Config["Path"]["Save_c"]).parent.exists()) or (not Path(Config["Path"]["Save_c"]).parent.is_dir()):
|
|
||||||
Path(Config["Path"]["Save_c"]).parent.mkdir(parents=True, exist_ok=True)
|
|
||||||
|
|
||||||
try:
|
try:
|
||||||
# Artifact_a.txt和Artifact_c.csv的内容遍历
|
# Artifact_a.txt和Artifact_c.csv的内容遍历
|
||||||
output_lines = []
|
output_lines = []
|
||||||
|
|||||||
@ -1085,9 +1085,6 @@ class Data():
|
|||||||
return Result().success(info=Constants.PREPROCESS_FINISHED)
|
return Result().success(info=Constants.PREPROCESS_FINISHED)
|
||||||
|
|
||||||
def save(self, label):
|
def save(self, label):
|
||||||
if (not Path(Config["Path"]["Save"]).parent.exists()) or (not Path(Config["Path"]["Save"]).parent.is_dir()):
|
|
||||||
Path(Config["Path"]["Save"]).parent.mkdir(parents=True, exist_ok=True)
|
|
||||||
|
|
||||||
if self.df_label is None:
|
if self.df_label is None:
|
||||||
return Result().failure(info=Filename.RESP_QUALITY_LABEL + Constants.SAVE_FAILURE + Constants.FAILURE_REASON["Data_Not_Exist"])
|
return Result().failure(info=Filename.RESP_QUALITY_LABEL + Constants.SAVE_FAILURE + Constants.FAILURE_REASON["Data_Not_Exist"])
|
||||||
|
|
||||||
|
|||||||
@ -323,9 +323,6 @@ class Data:
|
|||||||
return Result().success(info=Constants.CUT_PSG_ALIGN_LABEL_FINISHED)
|
return Result().success(info=Constants.CUT_PSG_ALIGN_LABEL_FINISHED)
|
||||||
|
|
||||||
def save(self):
|
def save(self):
|
||||||
if (not Path(Config["Path"]["SaveFolder"]).exists()) or (not Path(Config["Path"]["SaveFolder"]).is_dir()):
|
|
||||||
Path(Config["Path"]["SaveFolder"]).mkdir(parents=True, exist_ok=True)
|
|
||||||
|
|
||||||
for raw in self.raw.values():
|
for raw in self.raw.values():
|
||||||
if len(raw) == 0:
|
if len(raw) == 0:
|
||||||
return Result().failure(info=Constants.SAVE_FAILURE +
|
return Result().failure(info=Constants.SAVE_FAILURE +
|
||||||
|
|||||||
@ -460,9 +460,6 @@ class Data:
|
|||||||
return Result().success(info=Constants.DETECT_JPEAK_PREDICT_FINISHED)
|
return Result().success(info=Constants.DETECT_JPEAK_PREDICT_FINISHED)
|
||||||
|
|
||||||
def save(self, chunk):
|
def save(self, chunk):
|
||||||
if (not Path(Config["Path"]["Save"]).parent.exists()) or (not Path(Config["Path"]["Save"]).parent.is_dir()):
|
|
||||||
Path(Config["Path"]["Save"]).parent.mkdir(parents=True, exist_ok=True)
|
|
||||||
|
|
||||||
if self.peak is None:
|
if self.peak is None:
|
||||||
return Result().failure(info=Constants.SAVE_FAILURE + Constants.FAILURE_REASON["Data_Not_Exist"])
|
return Result().failure(info=Constants.SAVE_FAILURE + Constants.FAILURE_REASON["Data_Not_Exist"])
|
||||||
|
|
||||||
|
|||||||
@ -452,9 +452,6 @@ class Data:
|
|||||||
return Result().success(info=Constants.DETECT_RPEAK_PREDICT_FINISHED)
|
return Result().success(info=Constants.DETECT_RPEAK_PREDICT_FINISHED)
|
||||||
|
|
||||||
def save(self, chunk):
|
def save(self, chunk):
|
||||||
if (not Path(Config["Path"]["Save"]).parent.exists()) or (not Path(Config["Path"]["Save"]).parent.is_dir()):
|
|
||||||
Path(Config["Path"]["Save"]).parent.mkdir(parents=True, exist_ok=True)
|
|
||||||
|
|
||||||
if self.peak is None:
|
if self.peak is None:
|
||||||
|
|
||||||
return Result().failure(info=Constants.SAVE_FAILURE + Constants.FAILURE_REASON["Data_Not_Exist"])
|
return Result().failure(info=Constants.SAVE_FAILURE + Constants.FAILURE_REASON["Data_Not_Exist"])
|
||||||
|
|||||||
@ -960,9 +960,6 @@ class Data:
|
|||||||
return Result().success(info=Constants.INPUT_FINISHED)
|
return Result().success(info=Constants.INPUT_FINISHED)
|
||||||
|
|
||||||
def get_archive(self):
|
def get_archive(self):
|
||||||
if (not Path(Config["Path"]["Save"]).parent.exists()) or (not Path(Config["Path"]["Save"]).parent.is_dir()):
|
|
||||||
Path(Config["Path"]["Save"]).parent.mkdir(parents=True, exist_ok=True)
|
|
||||||
|
|
||||||
if not Path(Config["Path"]["Save"]).exists():
|
if not Path(Config["Path"]["Save"]).exists():
|
||||||
self.corrected_peak = self.original_peak
|
self.corrected_peak = self.original_peak
|
||||||
return Result().success(info=Constants.ARCHIVE_NOT_EXIST)
|
return Result().success(info=Constants.ARCHIVE_NOT_EXIST)
|
||||||
|
|||||||
@ -126,6 +126,7 @@ class MainWindow(QMainWindow, Ui_Signal_Label):
|
|||||||
self.approximately_align.show(root_path, int(sampID))
|
self.approximately_align.show(root_path, int(sampID))
|
||||||
# 默认最大化显示而非固定分辨率
|
# 默认最大化显示而非固定分辨率
|
||||||
self.approximately_align.showMaximized()
|
self.approximately_align.showMaximized()
|
||||||
|
self.check_save_path_and_mkdir(root_path, sampID)
|
||||||
|
|
||||||
def __slot_btn_preprocess__(self):
|
def __slot_btn_preprocess__(self):
|
||||||
self.preprocess = MainWindow_preprocess()
|
self.preprocess = MainWindow_preprocess()
|
||||||
@ -146,6 +147,7 @@ class MainWindow(QMainWindow, Ui_Signal_Label):
|
|||||||
self.preprocess.show(mode, root_path, int(sampID))
|
self.preprocess.show(mode, root_path, int(sampID))
|
||||||
# 默认最大化显示而非固定分辨率
|
# 默认最大化显示而非固定分辨率
|
||||||
self.preprocess.showMaximized()
|
self.preprocess.showMaximized()
|
||||||
|
self.check_save_path_and_mkdir(root_path, sampID)
|
||||||
|
|
||||||
def __slot_btn_detect_Jpeak__(self):
|
def __slot_btn_detect_Jpeak__(self):
|
||||||
self.detect_Jpeak = MainWindow_detect_Jpeak()
|
self.detect_Jpeak = MainWindow_detect_Jpeak()
|
||||||
@ -158,6 +160,7 @@ class MainWindow(QMainWindow, Ui_Signal_Label):
|
|||||||
self.detect_Jpeak.show(root_path, int(sampID))
|
self.detect_Jpeak.show(root_path, int(sampID))
|
||||||
# 默认最大化显示而非固定分辨率
|
# 默认最大化显示而非固定分辨率
|
||||||
self.detect_Jpeak.showMaximized()
|
self.detect_Jpeak.showMaximized()
|
||||||
|
self.check_save_path_and_mkdir(root_path, sampID)
|
||||||
|
|
||||||
def __slot_btn_detect_Rpeak__(self):
|
def __slot_btn_detect_Rpeak__(self):
|
||||||
self.detect_Rpeak = MainWindow_detect_Rpeak()
|
self.detect_Rpeak = MainWindow_detect_Rpeak()
|
||||||
@ -170,6 +173,7 @@ class MainWindow(QMainWindow, Ui_Signal_Label):
|
|||||||
self.detect_Rpeak.show(root_path, int(sampID))
|
self.detect_Rpeak.show(root_path, int(sampID))
|
||||||
# 默认最大化显示而非固定分辨率
|
# 默认最大化显示而非固定分辨率
|
||||||
self.detect_Rpeak.showMaximized()
|
self.detect_Rpeak.showMaximized()
|
||||||
|
self.check_save_path_and_mkdir(root_path, sampID)
|
||||||
|
|
||||||
def __slot_btn_label_check__(self):
|
def __slot_btn_label_check__(self):
|
||||||
self.label_check = MainWindow_label_check()
|
self.label_check = MainWindow_label_check()
|
||||||
@ -192,6 +196,7 @@ class MainWindow(QMainWindow, Ui_Signal_Label):
|
|||||||
self.label_check.show(mode, root_path, int(sampID))
|
self.label_check.show(mode, root_path, int(sampID))
|
||||||
# 默认最大化显示而非固定分辨率
|
# 默认最大化显示而非固定分辨率
|
||||||
self.label_check.showMaximized()
|
self.label_check.showMaximized()
|
||||||
|
self.check_save_path_and_mkdir(root_path, sampID)
|
||||||
|
|
||||||
def __slot_btn_precisely_align__(self):
|
def __slot_btn_precisely_align__(self):
|
||||||
self.precisely_align = MainWindow_precisely_align()
|
self.precisely_align = MainWindow_precisely_align()
|
||||||
@ -204,6 +209,7 @@ class MainWindow(QMainWindow, Ui_Signal_Label):
|
|||||||
self.precisely_align.show(root_path, int(sampID))
|
self.precisely_align.show(root_path, int(sampID))
|
||||||
# 默认最大化显示而非固定分辨率
|
# 默认最大化显示而非固定分辨率
|
||||||
self.precisely_align.showMaximized()
|
self.precisely_align.showMaximized()
|
||||||
|
self.check_save_path_and_mkdir(root_path, sampID)
|
||||||
|
|
||||||
def __slot_btn_cut_PSG__(self):
|
def __slot_btn_cut_PSG__(self):
|
||||||
self.cut_PSG = MainWindow_cut_PSG()
|
self.cut_PSG = MainWindow_cut_PSG()
|
||||||
@ -214,6 +220,7 @@ class MainWindow(QMainWindow, Ui_Signal_Label):
|
|||||||
if not self.check_sampID():
|
if not self.check_sampID():
|
||||||
return
|
return
|
||||||
self.cut_PSG.show(root_path, int(sampID))
|
self.cut_PSG.show(root_path, int(sampID))
|
||||||
|
self.check_save_path_and_mkdir(root_path, sampID)
|
||||||
|
|
||||||
def __slot_btn_artifact_label__(self):
|
def __slot_btn_artifact_label__(self):
|
||||||
self.artifact_label = MainWindow_artifact_label()
|
self.artifact_label = MainWindow_artifact_label()
|
||||||
@ -226,6 +233,7 @@ class MainWindow(QMainWindow, Ui_Signal_Label):
|
|||||||
self.artifact_label.show(root_path, int(sampID))
|
self.artifact_label.show(root_path, int(sampID))
|
||||||
# 默认最大化显示而非固定分辨率
|
# 默认最大化显示而非固定分辨率
|
||||||
self.artifact_label.showMaximized()
|
self.artifact_label.showMaximized()
|
||||||
|
self.check_save_path_and_mkdir(root_path, sampID)
|
||||||
|
|
||||||
def __slot_btn_bcg_quality_label__(self):
|
def __slot_btn_bcg_quality_label__(self):
|
||||||
self.bcg_quality_label = MainWindow_bcg_quality_label()
|
self.bcg_quality_label = MainWindow_bcg_quality_label()
|
||||||
@ -238,6 +246,7 @@ class MainWindow(QMainWindow, Ui_Signal_Label):
|
|||||||
self.bcg_quality_label.show(root_path, int(sampID))
|
self.bcg_quality_label.show(root_path, int(sampID))
|
||||||
# 默认最大化显示而非固定分辨率
|
# 默认最大化显示而非固定分辨率
|
||||||
self.bcg_quality_label.showMaximized()
|
self.bcg_quality_label.showMaximized()
|
||||||
|
self.check_save_path_and_mkdir(root_path, sampID)
|
||||||
|
|
||||||
def __slot_btn_resp_quality_label__(self):
|
def __slot_btn_resp_quality_label__(self):
|
||||||
self.resp_quality_label = MainWindow_resp_quality_label()
|
self.resp_quality_label = MainWindow_resp_quality_label()
|
||||||
@ -250,6 +259,7 @@ class MainWindow(QMainWindow, Ui_Signal_Label):
|
|||||||
self.resp_quality_label.show(root_path, int(sampID))
|
self.resp_quality_label.show(root_path, int(sampID))
|
||||||
# 默认最大化显示而非固定分辨率
|
# 默认最大化显示而非固定分辨率
|
||||||
self.resp_quality_label.showMaximized()
|
self.resp_quality_label.showMaximized()
|
||||||
|
self.check_save_path_and_mkdir(root_path, sampID)
|
||||||
|
|
||||||
def __slot_btn_SA_label__(self):
|
def __slot_btn_SA_label__(self):
|
||||||
self.SA_label = MainWindow_SA_label()
|
self.SA_label = MainWindow_SA_label()
|
||||||
@ -262,6 +272,7 @@ class MainWindow(QMainWindow, Ui_Signal_Label):
|
|||||||
self.SA_label.show(root_path, int(sampID))
|
self.SA_label.show(root_path, int(sampID))
|
||||||
# 默认最大化显示而非固定分辨率
|
# 默认最大化显示而非固定分辨率
|
||||||
self.SA_label.showMaximized()
|
self.SA_label.showMaximized()
|
||||||
|
self.check_save_path_and_mkdir(root_path, sampID)
|
||||||
|
|
||||||
def seek_sampID(self, path):
|
def seek_sampID(self, path):
|
||||||
if not Path(path).exists():
|
if not Path(path).exists():
|
||||||
@ -271,7 +282,6 @@ class MainWindow(QMainWindow, Ui_Signal_Label):
|
|||||||
sub_folders = [item.name for item in Path(path).iterdir() if item.is_dir()]
|
sub_folders = [item.name for item in Path(path).iterdir() if item.is_dir()]
|
||||||
self.ui.comboBox_sampID.addItems(sub_folders)
|
self.ui.comboBox_sampID.addItems(sub_folders)
|
||||||
|
|
||||||
|
|
||||||
def check_root_path(self):
|
def check_root_path(self):
|
||||||
if self.ui.plainTextEdit_root_path.toPlainText() == Constants.STRING_IS_EMPTY:
|
if self.ui.plainTextEdit_root_path.toPlainText() == Constants.STRING_IS_EMPTY:
|
||||||
PublicFunc.msgbox_output(self, Constants.MAINWINDOW_ROOT_PATH_NOT_EXIST, Constants.MSGBOX_TYPE_ERROR)
|
PublicFunc.msgbox_output(self, Constants.MAINWINDOW_ROOT_PATH_NOT_EXIST, Constants.MSGBOX_TYPE_ERROR)
|
||||||
@ -283,3 +293,16 @@ class MainWindow(QMainWindow, Ui_Signal_Label):
|
|||||||
PublicFunc.msgbox_output(self, Constants.MAINWINDOW_SAMPID_EMPTY, Constants.MSGBOX_TYPE_ERROR)
|
PublicFunc.msgbox_output(self, Constants.MAINWINDOW_SAMPID_EMPTY, Constants.MSGBOX_TYPE_ERROR)
|
||||||
return False
|
return False
|
||||||
return True
|
return True
|
||||||
|
|
||||||
|
def check_save_path_and_mkdir(self, root_path, sampID):
|
||||||
|
path_Label = Path(root_path) / Path(Filename.PATH_LABEL) / Path(str(sampID))
|
||||||
|
path_OrgBCG_Aligned = Path(root_path) / Path(Filename.PATH_ORGBCG_ALIGNED) / Path(str(sampID))
|
||||||
|
path_PSG_Aligned = Path(root_path) / Path(Filename.PATH_PSG_ALIGNED) / Path(str(sampID))
|
||||||
|
path_OrgBCG_Text = Path(root_path) / Path(Filename.PATH_ORGBCG_TEXT) / Path(str(sampID))
|
||||||
|
path_PSG_Text = Path(root_path) / Path(Filename.PATH_PSG_TEXT) / Path(str(sampID))
|
||||||
|
|
||||||
|
path_list = [path_Label, path_OrgBCG_Aligned, path_PSG_Aligned, path_OrgBCG_Text, path_PSG_Text]
|
||||||
|
|
||||||
|
for path in path_list:
|
||||||
|
if not path.exists():
|
||||||
|
path.mkdir(parents=True, exist_ok=True)
|
||||||
@ -1871,9 +1871,6 @@ class Data:
|
|||||||
return Result().success(info=info)
|
return Result().success(info=info)
|
||||||
|
|
||||||
def save_alignInfo(self):
|
def save_alignInfo(self):
|
||||||
if (not Path(Config["Path"]["Save_AlignInfo"]).parent.exists()) or (not Path(Config["Path"]["Save_AlignInfo"]).parent.is_dir()):
|
|
||||||
Path(Config["Path"]["Save_AlignInfo"]).parent.mkdir(parents=True, exist_ok=True)
|
|
||||||
|
|
||||||
try:
|
try:
|
||||||
save_data = {
|
save_data = {
|
||||||
"front": {
|
"front": {
|
||||||
|
|||||||
@ -474,9 +474,6 @@ class Data:
|
|||||||
return Result().success(info=Constants.PREPROCESS_FINISHED)
|
return Result().success(info=Constants.PREPROCESS_FINISHED)
|
||||||
|
|
||||||
def save(self, chunk):
|
def save(self, chunk):
|
||||||
if (not Path(Config["Path"]["Save"]).parent.exists()) or (not Path(Config["Path"]["Save"]).parent.is_dir()):
|
|
||||||
Path(Config["Path"]["Save"]).parent.mkdir(parents=True, exist_ok=True)
|
|
||||||
|
|
||||||
if self.processed_data is None:
|
if self.processed_data is None:
|
||||||
return Result().failure(info=Constants.SAVE_FAILURE + Constants.FAILURE_REASON["Data_Not_Exist"])
|
return Result().failure(info=Constants.SAVE_FAILURE + Constants.FAILURE_REASON["Data_Not_Exist"])
|
||||||
|
|
||||||
|
|||||||
@ -1458,9 +1458,6 @@ class Data():
|
|||||||
return BDR, band_low, band_high, bcg_spectrum, bcg_freq, tho_spectrum, tho_freq
|
return BDR, band_low, band_high, bcg_spectrum, bcg_freq, tho_spectrum, tho_freq
|
||||||
|
|
||||||
def save_resp_quality_label(self):
|
def save_resp_quality_label(self):
|
||||||
if (not Path(Config["Path"]["Save_Resp_quality_label"]).parent.exists()) or (not Path(Config["Path"]["Save_Resp_quality_label"]).parent.is_dir()):
|
|
||||||
Path(Config["Path"]["Save_Resp_quality_label"]).parent.mkdir(parents=True, exist_ok=True)
|
|
||||||
|
|
||||||
if self.resp_quality_label is None:
|
if self.resp_quality_label is None:
|
||||||
|
|
||||||
return Result().failure(info=Filename.RESP_QUALITY_LABEL + Constants.SAVE_FAILURE + Constants.FAILURE_REASON["Data_Not_Exist"])
|
return Result().failure(info=Filename.RESP_QUALITY_LABEL + Constants.SAVE_FAILURE + Constants.FAILURE_REASON["Data_Not_Exist"])
|
||||||
|
|||||||
Reference in New Issue
Block a user