[minor] improved convenience, small bugfix

This commit is contained in:
Marcel Paffrath 2018-08-15 15:51:41 +02:00
parent 8a187905cb
commit ce1564c2f8

View File

@ -3288,10 +3288,13 @@ class MainWindow(QMainWindow):
return return
if not fnm: if not fnm:
dlg = QFileDialog(parent=self) dlg = QFileDialog(parent=self)
fnm = dlg.getOpenFileName(self, 'Open project file...', filter='Pylot project (*.plp)') fnm = dlg.getOpenFileName(self, 'Open project file...', filter='Pylot project (*.plp)')[0]
if not fnm: if not fnm:
return return
fnm = fnm[0] if not os.path.exists(fnm):
QMessageBox.warning(self, 'Could not open file',
'Could not open project file {}. File does not exist.'.format(fnm))
return
if fnm: if fnm:
self.project = Project.load(fnm) self.project = Project.load(fnm)
if hasattr(self.project, 'parameter'): if hasattr(self.project, 'parameter'):
@ -3343,6 +3346,7 @@ class MainWindow(QMainWindow):
self.setDirty(False) self.setDirty(False)
self.saveProjectAsAction.setEnabled(True) self.saveProjectAsAction.setEnabled(True)
self.update_status('Saved new project to {}'.format(filename), duration=5000) self.update_status('Saved new project to {}'.format(filename), duration=5000)
self.add2recentProjects(filename)
return True return True
def saveProject(self, new=False): def saveProject(self, new=False):