A few tweaks to the dialog and code

This commit is contained in:
Veronica K. B. Olsen
2020-02-26 18:02:37 +01:00
parent 6b3e652440
commit 0587099d36
2 changed files with 10 additions and 4 deletions
+5 -1
View File
@@ -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)
+5 -3
View File
@@ -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