Remove the whole document read only logic

This commit is contained in:
Veronica K. B. Olsen
2020-06-07 23:19:28 +02:00
parent df0a80ed96
commit 1fc76b0d95
2 changed files with 13 additions and 26 deletions
+12 -21
View File
@@ -39,14 +39,13 @@ class NWDoc():
def __init__(self, theProject, theParent):
self.mainConf = nw.CONFIG
self.theProject = theProject
self.theParent = theParent
self.theItem = None
self.docHandle = None
self.docEditable = False
self.fileLoc = None
self.docMeta = ""
self.mainConf = nw.CONFIG
self.theProject = theProject
self.theParent = theParent
self.theItem = None
self.docHandle = None
self.fileLoc = None
self.docMeta = ""
# Internal Mapping
self.makeAlert = self.theParent.makeAlert
@@ -60,11 +59,10 @@ class NWDoc():
def clearDocument(self):
"""Clear the document contents.
"""
self.theItem = None
self.docHandle = None
self.docEditable = False
self.fileLoc = None
self.docMeta = ""
self.theItem = None
self.docHandle = None
self.fileLoc = None
self.docMeta = ""
return
def openDocument(self, tHandle, showStatus=True, isOrphan=False):
@@ -87,13 +85,6 @@ class NWDoc():
self.clearDocument()
return None
# By default, the document is editable.
# Except for files in the trash folder.
self.docEditable = True
if self.theItem is not None:
if self.theItem.parHandle == self.theProject.projTree.trashRoot():
self.docEditable = False
docFile = self.docHandle+".nwd"
logger.debug("Opening document %s" % docFile)
@@ -137,7 +128,7 @@ class NWDoc():
"""Save the document via temp file in case of save failure, and
in any case keep a backup of the file.
"""
if self.docHandle is None or not self.docEditable:
if self.docHandle is None:
return False
self.theProject.ensureFolderStructure()
+1 -5
View File
@@ -270,11 +270,7 @@ class GuiDocEditor(QTextEdit):
self.setDocumentChanged(False)
self.theHandle = tHandle
if self.nwDocument.docEditable:
self.setReadOnly(False)
else:
self.theParent.noticeBar.showNote("This document is read only.")
self.setReadOnly(False)
self.docTitle.setTitleFromHandle(self.theHandle)
self.updateDocMargins()
self.hLight.spellCheck = spTemp