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)
@@ -13,7 +13,7 @@ Some text here would look good as well, and maybe some "dialogue"?
So, this is some __text__ that weve been adding to this document. It is utterly meaningless text, _but_ since this is just dummy text, that doesnt really matter. The text is perfectly happy to live in this document regardless.
This paragraph is also meaningless. At least a bit. Its also very short. But we could make it less meaningless if we wanted to … but we wont.
This paragraph is also meaningless. At least a bit. Its also very short. But we could make it less meaningless if we wanted to … but we wont, will we.
This one is a bit longer. “It also has some dialogue in it” she said, before she moved on to check if the spellchecker worked. It did. “Cool,” she concluded.
+5
View File
@@ -8,3 +8,8 @@ Start: 2019-05-26 14:50:18 End: 2019-05-26 14:50:21 Words: 0
Start: 2019-05-26 14:50:29 End: 2019-05-26 14:50:47 Words: 3
Start: 2019-05-26 15:10:52 End: 2019-05-26 15:11:09 Words: 0
Start: 2019-05-26 15:28:56 End: 2019-05-26 15:29:08 Words: 0
Start: 2019-05-26 15:37:34 End: 2019-05-26 15:37:43 Words: -538
Start: 2019-05-26 15:37:47 End: 2019-05-26 15:38:07 Words: 538
Start: 2019-05-26 15:38:11 End: 2019-05-26 15:43:07 Words: 2
Start: 2019-05-26 15:49:18 End: 2019-05-26 15:49:47 Words: 0
Start: 2019-05-26 15:52:39 End: 2019-05-26 15:52:56 Words: 0
+6 -6
View File
@@ -1,5 +1,5 @@
<?xml version='1.0' encoding='utf-8'?>
<novelWriterXML appVersion="0.1.4" fileVersion="1.0" timeStamp="2019-05-26 15:29:08">
<novelWriterXML appVersion="0.1.4" fileVersion="1.0" timeStamp="2019-05-26 15:52:53">
<project>
<name>Sample Project</name>
<title>Sample Project</title>
@@ -8,9 +8,9 @@
</project>
<settings>
<spellCheck>True</spellCheck>
<lastEdited>None</lastEdited>
<lastEdited>636b6aa9b697b</lastEdited>
<lastViewed>None</lastViewed>
<lastWordCount>538</lastWordCount>
<lastWordCount>540</lastWordCount>
<status>
<entry blue="100" green="100" red="100">New</entry>
<entry blue="0" green="50" red="200">Notes</entry>
@@ -73,10 +73,10 @@
<status>Notes</status>
<expanded>False</expanded>
<layout>SCENE</layout>
<charCount>647</charCount>
<wordCount>119</wordCount>
<charCount>656</charCount>
<wordCount>121</wordCount>
<paraCount>5</paraCount>
<cursorPos>565</cursorPos>
<cursorPos>573</cursorPos>
</item>
<item handle="bc0cbd2a407f3" order="2" parent="e7ded148d6e4a">
<name>New File</name>