添加检查root路径输入,检查config文件文件夹是否存在
This commit is contained in:
@ -66,6 +66,7 @@ class MainWindow(QMainWindow, Ui_Signal_Label):
|
||||
@staticmethod
|
||||
def __read_config__():
|
||||
if not Path(ConfigParams.PUBLIC_CONFIG_FILE_PATH).exists():
|
||||
Path(ConfigParams.PUBLIC_CONFIG_FILE_PATH).parent.mkdir(parents=True, exist_ok=True)
|
||||
with open(ConfigParams.PUBLIC_CONFIG_FILE_PATH, "w") as f:
|
||||
dump(ConfigParams.PUBLIC_CONFIG_NEW_CONTENT, f)
|
||||
|
||||
@ -95,60 +96,90 @@ class MainWindow(QMainWindow, Ui_Signal_Label):
|
||||
def __slot_btn_approximately_align__(self):
|
||||
self.approximately_align = MainWindow_approximately_align()
|
||||
root_path = self.ui.plainTextEdit_root_path.toPlainText()
|
||||
sampID = int(self.ui.comboBox_sampID.currentText())
|
||||
self.approximately_align.show(root_path, sampID)
|
||||
sampID = self.ui.comboBox_sampID.currentText()
|
||||
if not self.check_root_path():
|
||||
return
|
||||
if not self.check_sampID():
|
||||
return
|
||||
self.approximately_align.show(root_path, int(sampID))
|
||||
|
||||
def __slot_btn_preprocess__(self):
|
||||
self.preprocess = MainWindow_preprocess()
|
||||
|
||||
sender = self.sender()
|
||||
root_path = self.ui.plainTextEdit_root_path.toPlainText()
|
||||
sampID = int(self.ui.comboBox_sampID.currentText())
|
||||
sampID = self.ui.comboBox_sampID.currentText()
|
||||
if sender == self.ui.pushButton_preprocess_BCG:
|
||||
mode = "BCG"
|
||||
elif sender == self.ui.pushButton_preprocess_ECG:
|
||||
mode = "ECG"
|
||||
else:
|
||||
raise ValueError("模式不存在")
|
||||
self.preprocess.show(mode, root_path, sampID)
|
||||
if not self.check_root_path():
|
||||
return
|
||||
if not self.check_sampID():
|
||||
return
|
||||
self.preprocess.show(mode, root_path, int(sampID))
|
||||
|
||||
def __slot_btn_detect_Jpeak__(self):
|
||||
self.detect_Jpeak = MainWindow_detect_Jpeak()
|
||||
root_path = self.ui.plainTextEdit_root_path.toPlainText()
|
||||
sampID = int(self.ui.comboBox_sampID.currentText())
|
||||
self.detect_Jpeak.show(root_path, sampID)
|
||||
sampID = self.ui.comboBox_sampID.currentText()
|
||||
if not self.check_root_path():
|
||||
return
|
||||
if not self.check_sampID():
|
||||
return
|
||||
self.detect_Jpeak.show(root_path, int(sampID))
|
||||
|
||||
def __slot_btn_detect_Rpeak__(self):
|
||||
self.detect_Rpeak = MainWindow_detect_Rpeak()
|
||||
root_path = self.ui.plainTextEdit_root_path.toPlainText()
|
||||
sampID = int(self.ui.comboBox_sampID.currentText())
|
||||
self.detect_Rpeak.show(root_path, sampID)
|
||||
sampID = self.ui.comboBox_sampID.currentText()
|
||||
if not self.check_root_path():
|
||||
return
|
||||
if not self.check_sampID():
|
||||
return
|
||||
self.detect_Rpeak.show(root_path, int(sampID))
|
||||
|
||||
def __slot_btn_label_check__(self):
|
||||
self.label_check = MainWindow_label_check()
|
||||
|
||||
sender = self.sender()
|
||||
root_path = self.ui.plainTextEdit_root_path.toPlainText()
|
||||
sampID = int(self.ui.comboBox_sampID.currentText())
|
||||
sampID = self.ui.comboBox_sampID.currentText()
|
||||
|
||||
if not self.check_root_path():
|
||||
return
|
||||
if not self.check_sampID():
|
||||
return
|
||||
|
||||
if sender == self.ui.pushButton_label_check_BCG:
|
||||
mode = "BCG"
|
||||
elif sender == self.ui.pushButton_label_check_ECG:
|
||||
mode = "ECG"
|
||||
else:
|
||||
raise ValueError("模式不存在")
|
||||
self.label_check.show(mode, root_path, sampID)
|
||||
self.label_check.show(mode, root_path, int(sampID))
|
||||
|
||||
def __slot_btn_precisely_align__(self):
|
||||
self.precisely_align = MainWindow_precisely_align()
|
||||
root_path = self.ui.plainTextEdit_root_path.toPlainText()
|
||||
sampID = int(self.ui.comboBox_sampID.currentText())
|
||||
self.precisely_align.show(root_path, sampID)
|
||||
sampID = self.ui.comboBox_sampID.currentText()
|
||||
if not self.check_root_path():
|
||||
return
|
||||
if not self.check_sampID():
|
||||
return
|
||||
self.precisely_align.show(root_path, int(sampID))
|
||||
|
||||
def __slot_btn_cut_PSG__(self):
|
||||
self.cut_PSG = MainWindow_cut_PSG()
|
||||
root_path = self.ui.plainTextEdit_root_path.toPlainText()
|
||||
sampID = int(self.ui.comboBox_sampID.currentText())
|
||||
self.cut_PSG.show(root_path, sampID)
|
||||
sampID = self.ui.comboBox_sampID.currentText()
|
||||
if not self.check_root_path():
|
||||
return
|
||||
if not self.check_sampID():
|
||||
return
|
||||
self.cut_PSG.show(root_path, int(sampID))
|
||||
|
||||
def seek_sampID(self, path):
|
||||
if not Path(path).exists():
|
||||
@ -157,3 +188,15 @@ class MainWindow(QMainWindow, Ui_Signal_Label):
|
||||
|
||||
sub_folders = [item.name for item in Path(path).iterdir() if item.is_dir()]
|
||||
self.ui.comboBox_sampID.addItems(sub_folders)
|
||||
|
||||
def check_root_path(self):
|
||||
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)
|
||||
return False
|
||||
return True
|
||||
|
||||
def check_sampID(self):
|
||||
if self.ui.comboBox_sampID.currentText() == Constants.STRING_IS_EMPTY:
|
||||
PublicFunc.msgbox_output(self, Constants.MAINWINDOW_SAMPID_EMPTY, Constants.MSGBOX_TYPE_ERROR)
|
||||
return False
|
||||
return True
|
||||
|
||||
Reference in New Issue
Block a user