Make NWDoc class non-reusable
This commit is contained in:
@@ -107,10 +107,10 @@ class GuiDocMerge(QDialog):
|
||||
)
|
||||
return
|
||||
|
||||
theDoc = NWDoc(self.theProject)
|
||||
theText = ""
|
||||
for tHandle in finalOrder:
|
||||
docText = theDoc.readDocument(tHandle).rstrip("\n")
|
||||
inDoc = NWDoc(self.theProject, tHandle)
|
||||
docText = inDoc.readDocument().rstrip("\n")
|
||||
if docText:
|
||||
theText += docText+"\n\n"
|
||||
|
||||
@@ -131,8 +131,9 @@ class GuiDocMerge(QDialog):
|
||||
newItem = self.theProject.projTree[nHandle]
|
||||
newItem.setStatus(srcItem.itemStatus)
|
||||
|
||||
theDoc.readDocument(nHandle)
|
||||
theDoc.writeDocument(theText)
|
||||
outDoc = NWDoc(self.theProject, nHandle)
|
||||
outDoc.writeDocument(theText)
|
||||
|
||||
self.theParent.treeView.revealNewTreeItem(nHandle)
|
||||
self.theParent.openDocument(nHandle, doScroll=True)
|
||||
|
||||
|
||||
@@ -127,8 +127,8 @@ class GuiDocSplit(QDialog):
|
||||
)
|
||||
return
|
||||
|
||||
theDoc = NWDoc(self.theProject)
|
||||
theText = theDoc.readDocument(self.sourceItem)
|
||||
inDoc = NWDoc(self.theProject, self.sourceItem)
|
||||
theText = inDoc.readDocument()
|
||||
if theText is None:
|
||||
theText = ""
|
||||
|
||||
@@ -217,9 +217,10 @@ class GuiDocSplit(QDialog):
|
||||
|
||||
theText = "\n".join(theLines[iStart:iEnd])
|
||||
theText = theText.rstrip("\n") + "\n\n"
|
||||
theDoc.readDocument(nHandle)
|
||||
theDoc.writeDocument(theText)
|
||||
theDoc.clearDocument()
|
||||
|
||||
outDoc = NWDoc(self.theProject, nHandle)
|
||||
outDoc.writeDocument(theText)
|
||||
|
||||
self.theParent.treeView.revealNewTreeItem(nHandle)
|
||||
|
||||
self._doClose()
|
||||
@@ -259,8 +260,8 @@ class GuiDocSplit(QDialog):
|
||||
return
|
||||
|
||||
self.listBox.clear()
|
||||
theDoc = NWDoc(self.theProject)
|
||||
theText = theDoc.readDocument(self.sourceItem)
|
||||
inDoc = NWDoc(self.theProject, self.sourceItem)
|
||||
theText = inDoc.readDocument()
|
||||
if theText is None:
|
||||
theText = ""
|
||||
|
||||
|
||||
Reference in New Issue
Block a user