From 0587099d368e710feaed3e55f4058fe9c0aebb2c Mon Sep 17 00:00:00 2001 From: "Veronica K. B. Olsen" <1619840+vkbo@users.noreply.github.com> Date: Wed, 26 Feb 2020 18:02:37 +0100 Subject: [PATCH] A few tweaks to the dialog and code --- nw/gui/dialogs/projectload.py | 6 +++++- nw/guimain.py | 8 +++++--- 2 files changed, 10 insertions(+), 4 deletions(-) diff --git a/nw/gui/dialogs/projectload.py b/nw/gui/dialogs/projectload.py index 6fe7f92c..3e773a9d 100644 --- a/nw/gui/dialogs/projectload.py +++ b/nw/gui/dialogs/projectload.py @@ -39,7 +39,7 @@ class GuiProjectLoad(QDialog): self.outerBox = QHBoxLayout() self.innerBox = QVBoxLayout() - self.setWindowTitle("Manage Projects") + self.setWindowTitle("Open Project") self.setLayout(self.outerBox) self.guiDeco = self.theParent.theTheme.loadDecoration("nwicon", (128, 128)) @@ -147,6 +147,7 @@ class GuiProjectLoad(QDialog): listData[theTime] = [theTitle, theWords, projPath] self.listBox.clear() + hasSelection = False for timeStamp in sorted(listOrder, reverse=True): newItem = QTreeWidgetItem([""]*4) newItem.setText(0, listData[timeStamp][0]) @@ -155,6 +156,9 @@ class GuiProjectLoad(QDialog): newItem.setText(3, listData[timeStamp][2]) newItem.setTextAlignment(1, Qt.AlignRight) self.listBox.addTopLevelItem(newItem) + if not hasSelection: + newItem.setSelected(True) + hasSelection = True self.listBox.resizeColumnToContents(0) self.listBox.resizeColumnToContents(1) diff --git a/nw/guimain.py b/nw/guimain.py index 99ad02f5..a9cd7edb 100644 --- a/nw/guimain.py +++ b/nw/guimain.py @@ -222,6 +222,8 @@ class GuiMain(QMainWindow): return True def newProject(self, projPath=None, forceNew=False): + """Create new project with a few default files and folders. + """ if self.hasProject: msgBox = QMessageBox() @@ -255,9 +257,9 @@ class GuiMain(QMainWindow): return True def closeProject(self, isYes=False): - """Closes the project if one is open. - isYes is passed on from the close application event so the user - doesn't get prompted twice. + """Closes the project if one is open. isYes is passed on from + the close application event so the user doesn't get prompted + twice. """ if not self.hasProject: # There is no project loaded, everything OK