1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161
| class Ui_save_restart(object): def finish_clicked(self): savecsv() widget2.close() pygame.quit() sys.exit()
def ok_clicked(self): savecsv() global current_round current_round = 0 print(current_round) global TrialID_text if self.TrialID.text() == "": TrialID_text = time.strftime("%Y-%m-%d_%H-%M-%S", time.localtime()) global SubjectID_text if self.SubjectID.text() == "": pass else: SubjectID_text = self.SubjectID.text() self.SubjectID.setPlaceholderText(SubjectID_text) self.TrialID.setPlaceholderText(TrialID_text) widget2.close()
def filepath_clicked(self): global filepath filepath = QFileDialog.getExistingDirectory(None) print(filepath) self.Filepath.setText(filepath) return
def setup_save_restart(self, Dialog): Dialog.setObjectName("Dialog") Dialog.resize(746, 612) font = QtGui.QFont() font.setKerning(True) Dialog.setFont(font) self.Tip1 = QtWidgets.QLabel(Dialog) self.Tip1.setGeometry(QtCore.QRect(20, 20, 701, 71)) font = QtGui.QFont() font.setFamily("Calibri") font.setPointSize(14) font.setBold(False) font.setWeight(50) self.Tip1.setFont(font) self.Tip1.setWordWrap(True) self.Tip1.setObjectName("Tip1") self.Tip2 = QtWidgets.QLabel(Dialog) self.Tip2.setGeometry(QtCore.QRect(20, 90, 701, 81)) font = QtGui.QFont() font.setFamily("Calibri") font.setPointSize(14) font.setBold(False) font.setWeight(50) self.Tip2.setFont(font) self.Tip2.setWordWrap(True) self.Tip2.setObjectName("Tip2") self.Tip3 = QtWidgets.QLabel(Dialog) self.Tip3.setGeometry(QtCore.QRect(20, 170, 701, 81)) font = QtGui.QFont() font.setFamily("Calibri") font.setPointSize(14) font.setBold(False) font.setWeight(50) self.Tip3.setFont(font) self.Tip3.setWordWrap(True) self.Tip3.setObjectName("Tip3") self.Tip4 = QtWidgets.QLabel(Dialog) self.Tip4.setGeometry(QtCore.QRect(20, 260, 701, 81)) font = QtGui.QFont() font.setFamily("Calibri") font.setPointSize(14) font.setBold(False) font.setWeight(50) self.Tip4.setFont(font) self.Tip4.setWordWrap(True) self.Tip4.setObjectName("Tip4") self.SettrialID_2 = QtWidgets.QLabel(Dialog) self.SettrialID_2.setGeometry(QtCore.QRect(100, 500, 121, 20)) font = QtGui.QFont() font.setFamily("Arial") font.setPointSize(12) font.setBold(False) font.setWeight(50) self.SettrialID_2.setFont(font) self.SettrialID_2.setObjectName("SettrialID_2") self.SubjectID = QtWidgets.QLineEdit(Dialog) self.SubjectID.setGeometry(QtCore.QRect(230, 370, 381, 31)) self.SubjectID.setObjectName("SubjectID") global SubjectID_text self.SubjectID.setPlaceholderText(SubjectID_text) self.Setsubjectid = QtWidgets.QLabel(Dialog) self.Setsubjectid.setGeometry(QtCore.QRect(80, 380, 141, 16)) font = QtGui.QFont() font.setFamily("Arial") font.setPointSize(12) font.setBold(False) font.setWeight(50) self.Setsubjectid.setFont(font) self.Setsubjectid.setObjectName("Setsubjectid") self.SettrialID = QtWidgets.QLabel(Dialog) self.SettrialID.setGeometry(QtCore.QRect(110, 440, 111, 16)) font = QtGui.QFont() font.setFamily("Arial") font.setPointSize(12) font.setBold(False) font.setWeight(50) self.SettrialID.setFont(font) self.SettrialID.setObjectName("SettrialID") self.TrialID = QtWidgets.QLineEdit(Dialog) self.TrialID.setGeometry(QtCore.QRect(230, 430, 381, 31)) self.TrialID.setObjectName("TrialID") global TrialID_text self.TrialID.setPlaceholderText(TrialID_text) self.finish = QtWidgets.QPushButton(Dialog) self.finish.setGeometry(QtCore.QRect(450, 550, 131, 31)) self.finish.setObjectName("finish") self.finish.clicked.connect(self.finish_clicked) self.ok = QtWidgets.QPushButton(Dialog) self.ok.setGeometry(QtCore.QRect(180, 550, 131, 31)) self.ok.setObjectName("ok") self.ok.clicked.connect(self.ok_clicked) self.Filepath = QtWidgets.QLineEdit(Dialog) self.Filepath.setGeometry(QtCore.QRect(230, 490, 381, 31)) self.Filepath.setObjectName("Filepath") self.Filepath.setPlaceholderText(filepath) self.set_file_path = QtWidgets.QPushButton(Dialog) self.set_file_path.setGeometry(QtCore.QRect(620, 490, 51, 28)) self.set_file_path.setObjectName("set_file_path") self.set_file_path.clicked.connect(self.filepath_clicked)
self.retranslateUi_save_restart(Dialog) QtCore.QMetaObject.connectSlotsByName(Dialog)
def retranslateUi_save_restart(self, Dialog): _translate = QtCore.QCoreApplication.translate Dialog.setWindowTitle(_translate("Dialog", "Next Trial?")) self.Tip1.setText(_translate("Dialog", "You have completed all the rounds and this is the end of this trial. If you want to quit, then click the \'Finish\' button or just close this window.")) self.Tip2.setText(_translate("Dialog", "You can reset your Subject ID and Trial ID if necessary. If you do not need to change your Subject ID, just click the \'OK\' button.")) self.Tip3.setText(_translate("Dialog", "If you want to begin a new trial, you must change your Trial ID. You can just click the \'OK\' button to use the default setting.")) self.Setsubjectid.setText(_translate("Dialog", "Set Subject ID")) self.SettrialID.setText(_translate("Dialog", "Set Trial ID")) self.finish.setText(_translate("Dialog", "Finish")) self.ok.setText(_translate("Dialog", "OK")) self.SettrialID_2.setText(_translate("Dialog", "Set file path: ")) self.set_file_path.setText(_translate("Dialog", "...")) self.Tip4.setText(_translate("Dialog", "The experiment result will be saved to a .csv file, you can set the filepath. Or the .csv file will be saved to the same path as the .py file. The file will be named as 'Subject ID-Date.csv'"))
|