Added closing of document feature

This commit is contained in:
Veronica K. B. Olsen
2019-05-26 15:55:10 +02:00
parent 76cb03fad8
commit c485851df3
5 changed files with 23 additions and 11 deletions
+1 -1
View File
@@ -257,7 +257,7 @@ class GuiMainMenu(QMenuBar):
menuItem = QAction(QIcon.fromTheme("document-revert"), "Close Document", self)
menuItem.setStatusTip("Close Current Document")
menuItem.setShortcut("Ctrl+W")
menuItem.triggered.connect(self.theParent.closeDocument)
menuItem.triggered.connect(self.theParent.closeDocEditor)
self.docuMenu.addAction(menuItem)
# Document > Separator
+10 -3
View File
@@ -258,8 +258,11 @@ class GuiMain(QMainWindow):
if not self.closeProject():
return False
# Do the stuff
self.theProject.openProject(projFile)
# Try to open the project
if not self.theProject.openProject(projFile):
return False
# Update GUI
self._setWindowTitle(self.theProject.projName)
self.rebuildTree()
self.docEditor.setPwl(path.join(self.theProject.projMeta, nwFiles.PROJ_DICT))
@@ -301,7 +304,6 @@ class GuiMain(QMainWindow):
self.saveDocument()
self.theDocument.clearDocument()
self.docEditor.clearEditor()
self.theProject.setLastEdited(None)
return True
def openDocument(self, tHandle):
@@ -478,6 +480,11 @@ class GuiMain(QMainWindow):
self.docViewer.setFocus()
return
def closeDocEditor(self):
self.closeDocument()
self.theProject.setLastEdited(None)
return
def closeDocViewer(self):
self.docViewer.clearViewer()
self.theProject.setLastViewed(None)