The editable flag for files is now respected by the editor, and trash files are not editable
This commit is contained in:
+18
-7
@@ -25,11 +25,12 @@ class NWDoc():
|
||||
|
||||
def __init__(self, theProject, theParent):
|
||||
|
||||
self.mainConf = nw.CONFIG
|
||||
self.theProject = theProject
|
||||
self.theParent = theParent
|
||||
self.theItem = None
|
||||
self.docHandle = None
|
||||
self.mainConf = nw.CONFIG
|
||||
self.theProject = theProject
|
||||
self.theParent = theParent
|
||||
self.theItem = None
|
||||
self.docHandle = None
|
||||
self.docEditable = False
|
||||
|
||||
# Internal Mapping
|
||||
self.makeAlert = self.theParent.makeAlert
|
||||
@@ -37,8 +38,9 @@ class NWDoc():
|
||||
return
|
||||
|
||||
def clearDocument(self):
|
||||
self.theItem = None
|
||||
self.docHandle = None
|
||||
self.theItem = None
|
||||
self.docHandle = None
|
||||
self.docEditable = False
|
||||
return
|
||||
|
||||
def openDocument(self, tHandle, showStatus=True):
|
||||
@@ -46,6 +48,15 @@ class NWDoc():
|
||||
self.docHandle = tHandle
|
||||
self.theItem = self.theProject.getItem(tHandle)
|
||||
|
||||
if self.theItem is None:
|
||||
self.clearDocument()
|
||||
return None
|
||||
|
||||
# By default, the document is editable. Except for files in the trash folder.
|
||||
self.docEditable = True
|
||||
if self.theItem.parHandle == self.theProject.trashRoot:
|
||||
self.docEditable = False
|
||||
|
||||
docDir, docFile = self._assemblePath(self.FILE_MN)
|
||||
logger.debug("Opening document %s" % path.join(docDir,docFile))
|
||||
dataDir = path.join(self.theProject.projPath, docDir)
|
||||
|
||||
Reference in New Issue
Block a user