From 053c2eb379274adead5f75be8b48d83bc667af6e Mon Sep 17 00:00:00 2001 From: "Veronica K. B. Olsen" <1619840+vkbo@users.noreply.github.com> Date: Fri, 15 Jan 2021 10:47:50 +0100 Subject: [PATCH] Set window title after new project is created, and also automatically call close if a project is open. --- nw/guimain.py | 12 +++++++----- 1 file changed, 7 insertions(+), 5 deletions(-) diff --git a/nw/guimain.py b/nw/guimain.py index 49d2d2bb..f8e9b9b2 100644 --- a/nw/guimain.py +++ b/nw/guimain.py @@ -282,11 +282,12 @@ class GuiMain(QMainWindow): """Create new project via the new project wizard. """ if self.hasProject: - self.makeAlert( - "Please close the current project before making a new one.", - nwAlert.ERROR - ) - return False + if not self.closeProject(): + self.makeAlert( + "Cannot create new project when another project is open.", + nwAlert.ERROR + ) + return False if projData is None: projData = self.showNewProjectDialog() @@ -313,6 +314,7 @@ class GuiMain(QMainWindow): self.hasProject = True self.statusBar.setRefTime(self.theProject.projOpened) self.rebuildIndex(beQuiet=True) + self._updateWindowTitle(self.theProject.projName) else: self.theProject.clearProject() return False