Remove the showStatus flag from document handling

This commit is contained in:
Veronica K. B. Olsen
2021-04-25 17:16:57 +02:00
parent d473615ccf
commit 45f726669e
7 changed files with 29 additions and 28 deletions
+1 -11
View File
@@ -68,7 +68,7 @@ class NWDoc():
self._docMeta = {}
return
def readDocument(self, tHandle, showStatus=True, isOrphan=False):
def readDocument(self, tHandle, isOrphan=False):
"""Read a document from handle, capturing potential file system
errors and parse meta data. If the document doesn't exist on
disk, return an empty string. If something went wrong, return
@@ -127,11 +127,6 @@ class NWDoc():
logger.debug("The requested document does not exist.")
return ""
if showStatus and not isOrphan:
self.theParent.setStatus(
self.tr("Opened Document: {0}").format(self._theItem.itemName)
)
return theText
def writeDocument(self, docText):
@@ -173,11 +168,6 @@ class NWDoc():
os.unlink(docPath)
os.rename(docTemp, docPath)
if self._theItem is not None:
self.theParent.setStatus(
self.tr("Saved Document: {0}").format(self._theItem.itemName)
)
return True
def deleteDocument(self, tHandle):
+1 -1
View File
@@ -117,7 +117,7 @@ class NWIndex():
return False
theDoc = NWDoc(self.theProject, self.theParent)
theText = theDoc.readDocument(tHandle, showStatus=False)
theText = theDoc.readDocument(tHandle)
if theText:
self.scanText(tHandle, theText)
+8 -8
View File
@@ -284,15 +284,15 @@ class NWProject():
self.projTree.setFileItemLayout(xHandle[5], nwItemLayout.TITLE)
self.projTree.setFileItemLayout(xHandle[7], nwItemLayout.CHAPTER)
aDoc.readDocument(xHandle[5], showStatus=False)
aDoc.readDocument(xHandle[5])
aDoc.writeDocument(titlePage)
aDoc.clearDocument()
aDoc.readDocument(xHandle[7], showStatus=False)
aDoc.readDocument(xHandle[7])
aDoc.writeDocument("## %s\n\n" % self.tr("New Chapter"))
aDoc.clearDocument()
aDoc.readDocument(xHandle[8], showStatus=False)
aDoc.readDocument(xHandle[8])
aDoc.writeDocument("### %s\n\n" % self.tr("New Scene"))
aDoc.clearDocument()
@@ -311,7 +311,7 @@ class NWProject():
tHandle = self.newFile(self.tr("Title Page"), nwItemClass.NOVEL, nHandle)
self.projTree.setFileItemLayout(tHandle, nwItemLayout.TITLE)
aDoc.readDocument(tHandle, showStatus=False)
aDoc.readDocument(tHandle)
aDoc.writeDocument(titlePage)
aDoc.clearDocument()
@@ -331,7 +331,7 @@ class NWProject():
cHandle = self.newFile(chTitle, nwItemClass.NOVEL, pHandle)
self.projTree.setFileItemLayout(cHandle, nwItemLayout.CHAPTER)
aDoc.readDocument(cHandle, showStatus=False)
aDoc.readDocument(cHandle)
aDoc.writeDocument("## %s\n\n" % chTitle)
aDoc.clearDocument()
@@ -341,7 +341,7 @@ class NWProject():
scTitle = self.tr("Scene {0}").format(f"{ch+1:d}.{sc+1:d}")
sHandle = self.newFile(scTitle, nwItemClass.NOVEL, pHandle)
aDoc.readDocument(sHandle, showStatus=False)
aDoc.readDocument(sHandle)
aDoc.writeDocument("### %s\n\n" % scTitle)
aDoc.clearDocument()
@@ -351,7 +351,7 @@ class NWProject():
scTitle = self.tr("Scene {0}").format(f"{sc+1:d}")
sHandle = self.newFile(scTitle, nwItemClass.NOVEL, nHandle)
aDoc.readDocument(sHandle, showStatus=False)
aDoc.readDocument(sHandle)
aDoc.writeDocument("### %s\n\n" % scTitle)
aDoc.clearDocument()
@@ -1404,7 +1404,7 @@ class NWProject():
oParent = None
oClass = None
oLayout = None
if aDoc.readDocument(oHandle, showStatus=False, isOrphan=True) is not None:
if aDoc.readDocument(oHandle, isOrphan=True) is not None:
oName, oParent, oClass, oLayout = aDoc.getMeta()
if oName: