def __init__(self, parent): try: filePicker = QFileDialog() fileName = filePicker.getOpenFileName(parent, "Open File", "DSPToolProjects (*.dsp)") f = open (fileName[0], "r") parent.parent.project = pickle.load(f) f.close() filePicker.destroy() parent.parent.fileMenu.saveProjectAction.setEnabled(True) parent.parent.signalMenu.addSignalAction.setEnabled(True) parent.parent.signalMenu.applyOperationAction.setEnabled(True) msg = QMessageBox(parent.parent) msg.setText("Project opened") msg.show() parent.parent.refreshTable() except: #tratar melhor msg = QErrorMessage(parent.parent) msg.showMessage("Invalid File")
def okClicked(self): if self.directory != "" and self.textBox.text() != "": try: if self.parent.parent.platform == "linux2": os.mkdir(self.directory + "/"+ self.textBox.text()) self.parent.parent.project = Project(self.directory + "/"+ self.textBox.text(), self.textBox.text(), "linux2") elif self.parent.parent.platform == "win32": os.mkdir(self.directory + "\\"+ self.textBox.text()) self.parent.parent.project = Project(self.directory + "\\"+ self.textBox.text(), self.textBox.text(), "win32") self.parent.parent.project.save() self.dialog.setVisible(False) self.parent.parent.fileMenu.saveProjectAction.setEnabled(True) self.parent.parent.signalMenu.addSignalAction.setEnabled(True) self.parent.parent.signalMenu.applyOperationAction.setEnabled(True) msg = QMessageBox(self.parent.parent) msg.setText("Project created") msg.show() except OSError: msg = QErrorMessage(self.parent.parent) msg.showMessage("Project already exists")
def okClicked(): global directory if directory != "" and textBox.text() != "": try: os.mkdir(directory + "/"+ textBox.text()) parent.parent.project = Project(directory + "/"+ textBox.text(), textBox.text()) parent.parent.project.save() dialog.setVisible(False) parent.parent.fileMenu.saveProjectAction.setEnabled(True) parent.parent.signalMenu.addSignalAction.setEnabled(True) parent.parent.signalMenu.applyOperationAction.setEnabled(True) msg = QMessageBox(parent.parent) msg.setText("Project created") msg.show() except OSError: msg = QErrorMessage(parent.parent) msg.showMessage("Project already exists")