Make NWDoc class non-reusable
This commit is contained in:
+5
-3
@@ -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()
|
||||
|
||||
+4
-4
@@ -286,8 +286,8 @@ class GuiProjectTree(QTreeWidget):
|
||||
return True
|
||||
|
||||
# This is a new files, so let's add some content
|
||||
newDoc = NWDoc(self.theProject)
|
||||
curTxt = newDoc.readDocument(tHandle)
|
||||
newDoc = NWDoc(self.theProject, tHandle)
|
||||
curTxt = newDoc.readDocument()
|
||||
if curTxt is None:
|
||||
curTxt = ""
|
||||
|
||||
@@ -527,8 +527,8 @@ class GuiProjectTree(QTreeWidget):
|
||||
if self.theParent.docEditor.theHandle == tHandle:
|
||||
self.theParent.closeDocument()
|
||||
|
||||
theDoc = NWDoc(self.theProject)
|
||||
theDoc.deleteDocument(tHandle)
|
||||
delDoc = NWDoc(self.theProject, tHandle)
|
||||
delDoc.deleteDocument()
|
||||
self.theIndex.deleteHandle(tHandle)
|
||||
self._deleteTreeItem(tHandle)
|
||||
self._setTreeChanged(True)
|
||||
|
||||
Reference in New Issue
Block a user