Rename open and save document to read and write in NWDoc

This commit is contained in:
Veronica K. B. Olsen
2021-04-25 17:10:12 +02:00
parent 1e48c6dcfe
commit d473615ccf
11 changed files with 67 additions and 59 deletions
+3 -3
View File
@@ -297,7 +297,7 @@ class GuiDocEditor(QTextEdit):
document is new (empty string), we set up the editor for editing
the file.
"""
theDoc = self.nwDocument.openDocument(tHandle, showStatus=showStatus)
theDoc = self.nwDocument.readDocument(tHandle, showStatus=showStatus)
if theDoc is None:
# There was an io error
self.clearEditor()
@@ -438,7 +438,7 @@ class GuiDocEditor(QTextEdit):
theItem.setParaCount(self.paraCount)
self.saveCursorPosition()
self.nwDocument.saveDocument(docText)
self.nwDocument.writeDocument(docText)
self.setDocumentChanged(False)
self.theIndex.scanText(tHandle, docText)
@@ -454,7 +454,7 @@ class GuiDocEditor(QTextEdit):
if self.theProject.projTree.updateItemLayout(tHandle, hLevel):
self.theParent.treeView.setTreeItemValues(tHandle)
self.nwDocument.saveDocument(docText)
self.nwDocument.writeDocument(docText)
self.docFooter.updateInfo()
return True
+5 -2
View File
@@ -287,7 +287,10 @@ class GuiProjectTree(QTreeWidget):
# This is a new files, so let's add some content
newDoc = NWDoc(self.theProject, self.theParent)
curTxt = newDoc.openDocument(tHandle, showStatus=False)
curTxt = newDoc.readDocument(tHandle, showStatus=False)
if curTxt is None:
curTxt = ""
if curTxt == "":
if nwItem.itemLayout == nwItemLayout.CHAPTER:
newText = f"## {nwItem.itemName}\n\n"
@@ -299,7 +302,7 @@ class GuiProjectTree(QTreeWidget):
newText = f"# {nwItem.itemName}\n\n"
# Save the text and index it
newDoc.saveDocument(newText)
newDoc.writeDocument(newText)
self.theIndex.scanText(tHandle, newText)
# Get Word Counts