Make NWDoc class non-reusable

This commit is contained in:
Veronica K. B. Olsen
2021-04-25 23:01:20 +02:00
parent fd28cbca4e
commit 470daf0036
8 changed files with 50 additions and 65 deletions
+5 -3
View File
@@ -75,7 +75,7 @@ class GuiDocEditor(QTextEdit):
self.theTheme = theParent.theTheme
self.theIndex = theParent.theIndex
self.theProject = theParent.theProject
self.nwDocument = NWDoc(self.theProject)
self.nwDocument = NWDoc(self.theProject, None)
self.docChanged = False # Flag for changed status of document
self.spellCheck = False # Flag for spell checking enabled
@@ -165,7 +165,7 @@ class GuiDocEditor(QTextEdit):
"""Clear the current document and reset all document related
flags and counters.
"""
self.nwDocument.clearDocument()
self.nwDocument = NWDoc(self.theProject, None)
self.setReadOnly(True)
self.clear()
self.wcTimer.stop()
@@ -297,7 +297,9 @@ class GuiDocEditor(QTextEdit):
document is new (empty string), we set up the editor for editing
the file.
"""
theDoc = self.nwDocument.readDocument(tHandle)
self.nwDocument = NWDoc(self.theProject, tHandle)
theDoc = self.nwDocument.readDocument()
if theDoc is None:
# There was an io error
self.clearEditor()