Make better use of the new NWItem functions and do some cleanup
This commit is contained in:
@@ -30,7 +30,7 @@ import logging
|
|||||||
|
|
||||||
from time import time
|
from time import time
|
||||||
|
|
||||||
from novelwriter.enum import nwItemType, nwItemClass, nwItemLayout
|
from novelwriter.enum import nwItemType, nwItemLayout
|
||||||
from novelwriter.error import logException
|
from novelwriter.error import logException
|
||||||
from novelwriter.constants import nwFiles, nwKeyWords, nwUnicode
|
from novelwriter.constants import nwFiles, nwKeyWords, nwUnicode
|
||||||
from novelwriter.core.document import NWDoc
|
from novelwriter.core.document import NWDoc
|
||||||
@@ -227,11 +227,8 @@ class NWIndex():
|
|||||||
if theItem.itemParent is None:
|
if theItem.itemParent is None:
|
||||||
logger.info("Not indexing orphaned item '%s'", tHandle)
|
logger.info("Not indexing orphaned item '%s'", tHandle)
|
||||||
return False
|
return False
|
||||||
if theItem.itemClass == nwItemClass.TRASH:
|
if theItem.isInactive():
|
||||||
logger.debug("Not indexing trash item '%s'", tHandle)
|
logger.debug("Not indexing inactive item '%s'", tHandle)
|
||||||
return False
|
|
||||||
if theItem.itemClass == nwItemClass.ARCHIVE:
|
|
||||||
logger.debug("Not indexing archived item '%s'", tHandle)
|
|
||||||
return False
|
return False
|
||||||
|
|
||||||
itemClass = theItem.itemClass
|
itemClass = theItem.itemClass
|
||||||
|
|||||||
+34
-37
@@ -35,9 +35,6 @@ from novelwriter.constants import nwLabels, trConst
|
|||||||
|
|
||||||
logger = logging.getLogger(__name__)
|
logger = logging.getLogger(__name__)
|
||||||
|
|
||||||
# Deprecated layout labels
|
|
||||||
DEP_LAYOUTS = ("TITLE", "PAGE", "BOOK", "PARTITION", "UNNUMBERED", "CHAPTER", "SCENE")
|
|
||||||
|
|
||||||
|
|
||||||
class NWItem():
|
class NWItem():
|
||||||
|
|
||||||
@@ -365,33 +362,33 @@ class NWItem():
|
|||||||
self._name = ""
|
self._name = ""
|
||||||
return
|
return
|
||||||
|
|
||||||
def setHandle(self, tHandle):
|
def setHandle(self, handle):
|
||||||
"""Set the item handle, and ensure it is valid.
|
"""Set the item handle, and ensure it is valid.
|
||||||
"""
|
"""
|
||||||
if isHandle(tHandle):
|
if isHandle(handle):
|
||||||
self._handle = tHandle
|
self._handle = handle
|
||||||
else:
|
else:
|
||||||
self._handle = None
|
self._handle = None
|
||||||
return
|
return
|
||||||
|
|
||||||
def setParent(self, pHandle):
|
def setParent(self, handle):
|
||||||
"""Set the parent handle, and ensure it is valid.
|
"""Set the parent handle, and ensure it is valid.
|
||||||
"""
|
"""
|
||||||
if pHandle is None:
|
if handle is None:
|
||||||
self._parent = None
|
self._parent = None
|
||||||
elif isHandle(pHandle):
|
elif isHandle(handle):
|
||||||
self._parent = pHandle
|
self._parent = handle
|
||||||
else:
|
else:
|
||||||
self._parent = None
|
self._parent = None
|
||||||
return
|
return
|
||||||
|
|
||||||
def setRoot(self, rHandle):
|
def setRoot(self, handle):
|
||||||
"""Set the root handle, and ensure it is valid.
|
"""Set the root handle, and ensure it is valid.
|
||||||
"""
|
"""
|
||||||
if rHandle is None:
|
if handle is None:
|
||||||
self._root = None
|
self._root = None
|
||||||
elif isHandle(rHandle):
|
elif isHandle(handle):
|
||||||
self._root = rHandle
|
self._root = handle
|
||||||
else:
|
else:
|
||||||
self._root = None
|
self._root = None
|
||||||
return
|
return
|
||||||
@@ -404,59 +401,59 @@ class NWItem():
|
|||||||
self._order = checkInt(order, 0)
|
self._order = checkInt(order, 0)
|
||||||
return
|
return
|
||||||
|
|
||||||
def setType(self, itemType):
|
def setType(self, value):
|
||||||
"""Set the item type from either a proper nwItemType, or set it
|
"""Set the item type from either a proper nwItemType, or set it
|
||||||
from a string representing an nwItemType.
|
from a string representing an nwItemType.
|
||||||
"""
|
"""
|
||||||
if isinstance(itemType, nwItemType):
|
if isinstance(value, nwItemType):
|
||||||
self._type = itemType
|
self._type = value
|
||||||
elif isItemType(itemType):
|
elif isItemType(value):
|
||||||
self._type = nwItemType[itemType]
|
self._type = nwItemType[value]
|
||||||
else:
|
else:
|
||||||
logger.error("Unrecognised item type '%s'", itemType)
|
logger.error("Unrecognised item type '%s'", value)
|
||||||
self._type = nwItemType.NO_TYPE
|
self._type = nwItemType.NO_TYPE
|
||||||
return
|
return
|
||||||
|
|
||||||
def setClass(self, itemClass):
|
def setClass(self, value):
|
||||||
"""Set the item class from either a proper nwItemClass, or set
|
"""Set the item class from either a proper nwItemClass, or set
|
||||||
it from a string representing an nwItemClass.
|
it from a string representing an nwItemClass.
|
||||||
"""
|
"""
|
||||||
if isinstance(itemClass, nwItemClass):
|
if isinstance(value, nwItemClass):
|
||||||
self._class = itemClass
|
self._class = value
|
||||||
elif isItemClass(itemClass):
|
elif isItemClass(value):
|
||||||
self._class = nwItemClass[itemClass]
|
self._class = nwItemClass[value]
|
||||||
else:
|
else:
|
||||||
logger.error("Unrecognised item class '%s'", itemClass)
|
logger.error("Unrecognised item class '%s'", value)
|
||||||
self._class = nwItemClass.NO_CLASS
|
self._class = nwItemClass.NO_CLASS
|
||||||
return
|
return
|
||||||
|
|
||||||
def setLayout(self, itemLayout):
|
def setLayout(self, value):
|
||||||
"""Set the item layout from either a proper nwItemLayout, or set
|
"""Set the item layout from either a proper nwItemLayout, or set
|
||||||
it from a string representing an nwItemLayout.
|
it from a string representing an nwItemLayout.
|
||||||
"""
|
"""
|
||||||
if isinstance(itemLayout, nwItemLayout):
|
if isinstance(value, nwItemLayout):
|
||||||
self._layout = itemLayout
|
self._layout = value
|
||||||
elif isItemLayout(itemLayout):
|
elif isItemLayout(value):
|
||||||
self._layout = nwItemLayout[itemLayout]
|
self._layout = nwItemLayout[value]
|
||||||
elif itemLayout in DEP_LAYOUTS:
|
elif value in ("TITLE", "PAGE", "BOOK", "PARTITION", "UNNUMBERED", "CHAPTER", "SCENE"):
|
||||||
self._layout = nwItemLayout.DOCUMENT
|
self._layout = nwItemLayout.DOCUMENT
|
||||||
else:
|
else:
|
||||||
logger.error("Unrecognised item layout '%s'", itemLayout)
|
logger.error("Unrecognised item layout '%s'", value)
|
||||||
self._layout = nwItemLayout.NO_LAYOUT
|
self._layout = nwItemLayout.NO_LAYOUT
|
||||||
return
|
return
|
||||||
|
|
||||||
def setStatus(self, itemStatus):
|
def setStatus(self, value):
|
||||||
"""Set the item status by looking it up in the valid status
|
"""Set the item status by looking it up in the valid status
|
||||||
items of the current project.
|
items of the current project.
|
||||||
"""
|
"""
|
||||||
self._status = self.theProject.statusItems.check(itemStatus)
|
self._status = self.theProject.statusItems.check(value)
|
||||||
return
|
return
|
||||||
|
|
||||||
def setImport(self, itemImport):
|
def setImport(self, value):
|
||||||
"""Set the item importance by looking it up in the valid import
|
"""Set the item importance by looking it up in the valid import
|
||||||
items of the current project.
|
items of the current project.
|
||||||
"""
|
"""
|
||||||
self._import = self.theProject.importItems.check(itemImport)
|
self._import = self.theProject.importItems.check(value)
|
||||||
return
|
return
|
||||||
|
|
||||||
def setExpanded(self, state):
|
def setExpanded(self, state):
|
||||||
|
|||||||
@@ -292,13 +292,6 @@ class NWTree():
|
|||||||
return True
|
return True
|
||||||
return False
|
return False
|
||||||
|
|
||||||
def isTrashRoot(self, tHandle):
|
|
||||||
"""Check if a handle is the trash folder.
|
|
||||||
"""
|
|
||||||
if self._trashRoot is None:
|
|
||||||
return False
|
|
||||||
return tHandle == self._trashRoot
|
|
||||||
|
|
||||||
def trashRoot(self):
|
def trashRoot(self):
|
||||||
"""Returns the handle of the trash folder, or None if there
|
"""Returns the handle of the trash folder, or None if there
|
||||||
isn't one.
|
isn't one.
|
||||||
@@ -307,14 +300,6 @@ class NWTree():
|
|||||||
return self._trashRoot
|
return self._trashRoot
|
||||||
return None
|
return None
|
||||||
|
|
||||||
def archiveRoot(self):
|
|
||||||
"""Returns the handle of the archive folder, or None if there
|
|
||||||
isn't one.
|
|
||||||
"""
|
|
||||||
if self._archRoot:
|
|
||||||
return self._archRoot
|
|
||||||
return None
|
|
||||||
|
|
||||||
def findRoot(self, theClass):
|
def findRoot(self, theClass):
|
||||||
"""Find the first root item for a given class.
|
"""Find the first root item for a given class.
|
||||||
"""
|
"""
|
||||||
|
|||||||
@@ -444,8 +444,7 @@ class GuiProjectTree(QTreeWidget):
|
|||||||
logger.error("Could not delete item")
|
logger.error("Could not delete item")
|
||||||
return False
|
return False
|
||||||
|
|
||||||
pHandle = nwItemS.itemParent
|
if self.theProject.projTree.isTrash(tHandle):
|
||||||
if self.theProject.projTree.isTrashRoot(pHandle):
|
|
||||||
# If the file is in the trash folder already, as the
|
# If the file is in the trash folder already, as the
|
||||||
# user if they want to permanently delete the file.
|
# user if they want to permanently delete the file.
|
||||||
doPermanent = False
|
doPermanent = False
|
||||||
|
|||||||
@@ -785,10 +785,7 @@ class GuiBuildNovel(QDialog):
|
|||||||
|
|
||||||
isNone = theItem.itemType != nwItemType.FILE
|
isNone = theItem.itemType != nwItemType.FILE
|
||||||
isNone |= theItem.itemLayout == nwItemLayout.NO_LAYOUT
|
isNone |= theItem.itemLayout == nwItemLayout.NO_LAYOUT
|
||||||
isNone |= theItem.itemClass == nwItemClass.NO_CLASS
|
isNone |= theItem.isInactive()
|
||||||
isNone |= theItem.itemClass == nwItemClass.ARCHIVE
|
|
||||||
isNone |= theItem.itemClass == nwItemClass.TRASH
|
|
||||||
isNone |= theItem.itemParent == self.theProject.projTree.trashRoot()
|
|
||||||
isNone |= theItem.itemParent is None
|
isNone |= theItem.itemParent is None
|
||||||
isNote = theItem.itemLayout == nwItemLayout.NOTE
|
isNote = theItem.itemLayout == nwItemLayout.NOTE
|
||||||
isNovel = not isNone and not isNote
|
isNovel = not isNone and not isNote
|
||||||
|
|||||||
+30
-30
@@ -1,13 +1,13 @@
|
|||||||
<?xml version='1.0' encoding='utf-8'?>
|
<?xml version='1.0' encoding='utf-8'?>
|
||||||
<novelWriterXML appVersion="1.7-alpha0" hexVersion="0x010700a0" fileVersion="1.4" timeStamp="2022-04-05 23:14:56">
|
<novelWriterXML appVersion="1.7-alpha0" hexVersion="0x010700a0" fileVersion="1.4" timeStamp="2022-04-17 19:05:24">
|
||||||
<project>
|
<project>
|
||||||
<name>Sample Project</name>
|
<name>Sample Project</name>
|
||||||
<title>Sample Project</title>
|
<title>Sample Project</title>
|
||||||
<author>Jane Smith</author>
|
<author>Jane Smith</author>
|
||||||
<author>Jay Doh</author>
|
<author>Jay Doh</author>
|
||||||
<saveCount>1303</saveCount>
|
<saveCount>1306</saveCount>
|
||||||
<autoCount>199</autoCount>
|
<autoCount>199</autoCount>
|
||||||
<editTime>65049</editTime>
|
<editTime>65149</editTime>
|
||||||
</project>
|
</project>
|
||||||
<settings>
|
<settings>
|
||||||
<doBackup>False</doBackup>
|
<doBackup>False</doBackup>
|
||||||
@@ -33,7 +33,7 @@
|
|||||||
<section></section>
|
<section></section>
|
||||||
</titleFormat>
|
</titleFormat>
|
||||||
<status>
|
<status>
|
||||||
<entry key="sf12341" count="6" red="100" green="100" blue="100">New</entry>
|
<entry key="sf12341" count="5" red="100" green="100" blue="100">New</entry>
|
||||||
<entry key="sf24ce6" count="1" red="200" green="50" blue="0">Notes</entry>
|
<entry key="sf24ce6" count="1" red="200" green="50" blue="0">Notes</entry>
|
||||||
<entry key="sc24b8f" count="2" red="182" green="60" blue="0">Started</entry>
|
<entry key="sc24b8f" count="2" red="182" green="60" blue="0">Started</entry>
|
||||||
<entry key="s90e6c9" count="6" red="193" green="129" blue="0">1st Draft</entry>
|
<entry key="s90e6c9" count="6" red="193" green="129" blue="0">1st Draft</entry>
|
||||||
@@ -42,110 +42,110 @@
|
|||||||
<entry key="s78ea90" count="0" red="58" green="180" blue="58">Finished</entry>
|
<entry key="s78ea90" count="0" red="58" green="180" blue="58">Finished</entry>
|
||||||
</status>
|
</status>
|
||||||
<importance>
|
<importance>
|
||||||
<entry key="ia857f0" count="4" red="100" green="100" blue="100">None</entry>
|
<entry key="ia857f0" count="5" red="100" green="100" blue="100">None</entry>
|
||||||
<entry key="icfb3a5" count="2" red="0" green="122" blue="188">Minor</entry>
|
<entry key="icfb3a5" count="2" red="0" green="122" blue="188">Minor</entry>
|
||||||
<entry key="i2d7a54" count="2" red="21" green="0" blue="180">Major</entry>
|
<entry key="i2d7a54" count="2" red="21" green="0" blue="180">Major</entry>
|
||||||
<entry key="i56be10" count="1" red="117" green="0" blue="175">Main</entry>
|
<entry key="i56be10" count="1" red="117" green="0" blue="175">Main</entry>
|
||||||
</importance>
|
</importance>
|
||||||
</settings>
|
</settings>
|
||||||
<content count="25">
|
<content count="25">
|
||||||
<item handle="7031beac91f75" parent="None" order="0" type="ROOT" class="NOVEL">
|
<item handle="7031beac91f75" parent="None" root="7031beac91f75" order="0" type="ROOT" class="NOVEL">
|
||||||
<meta expanded="True"/>
|
<meta expanded="True"/>
|
||||||
<name status="sc24b8f" import="ia857f0">Novel</name>
|
<name status="sc24b8f" import="ia857f0">Novel</name>
|
||||||
</item>
|
</item>
|
||||||
<item handle="53b69b83cdafc" parent="7031beac91f75" order="0" type="FILE" class="NOVEL" layout="DOCUMENT">
|
<item handle="53b69b83cdafc" parent="7031beac91f75" root="7031beac91f75" order="0" type="FILE" class="NOVEL" layout="DOCUMENT">
|
||||||
<meta charCount="93" wordCount="19" paraCount="2" cursorPos="2"/>
|
<meta charCount="93" wordCount="19" paraCount="2" cursorPos="2"/>
|
||||||
<name status="sc24b8f" import="ia857f0" exported="True">Title Page</name>
|
<name status="sc24b8f" import="ia857f0" exported="True">Title Page</name>
|
||||||
</item>
|
</item>
|
||||||
<item handle="974e400180a99" parent="7031beac91f75" order="1" type="FILE" class="NOVEL" layout="DOCUMENT">
|
<item handle="974e400180a99" parent="7031beac91f75" root="7031beac91f75" order="1" type="FILE" class="NOVEL" layout="DOCUMENT">
|
||||||
<meta charCount="186" wordCount="39" paraCount="2" cursorPos="212"/>
|
<meta charCount="186" wordCount="39" paraCount="2" cursorPos="212"/>
|
||||||
<name status="sf12341" import="ia857f0" exported="True">Page</name>
|
<name status="sf12341" import="ia857f0" exported="True">Page</name>
|
||||||
</item>
|
</item>
|
||||||
<item handle="edca4be2fcaf8" parent="7031beac91f75" order="2" type="FILE" class="NOVEL" layout="DOCUMENT">
|
<item handle="edca4be2fcaf8" parent="7031beac91f75" root="7031beac91f75" order="2" type="FILE" class="NOVEL" layout="DOCUMENT">
|
||||||
<meta charCount="26" wordCount="6" paraCount="1" cursorPos="33"/>
|
<meta charCount="26" wordCount="6" paraCount="1" cursorPos="33"/>
|
||||||
<name status="sf12341" import="ia857f0" exported="True">Part One</name>
|
<name status="sf12341" import="ia857f0" exported="True">Part One</name>
|
||||||
</item>
|
</item>
|
||||||
<item handle="e7ded148d6e4a" parent="7031beac91f75" order="3" type="FOLDER" class="NOVEL">
|
<item handle="e7ded148d6e4a" parent="7031beac91f75" root="7031beac91f75" order="3" type="FOLDER" class="NOVEL">
|
||||||
<meta expanded="True"/>
|
<meta expanded="True"/>
|
||||||
<name status="s90e6c9" import="ia857f0">A Folder</name>
|
<name status="s90e6c9" import="ia857f0">A Folder</name>
|
||||||
</item>
|
</item>
|
||||||
<item handle="6a2d6d5f4f401" parent="e7ded148d6e4a" order="0" type="FILE" class="NOVEL" layout="DOCUMENT">
|
<item handle="6a2d6d5f4f401" parent="e7ded148d6e4a" root="7031beac91f75" order="0" type="FILE" class="NOVEL" layout="DOCUMENT">
|
||||||
<meta charCount="75" wordCount="14" paraCount="1" cursorPos="279"/>
|
<meta charCount="75" wordCount="14" paraCount="1" cursorPos="279"/>
|
||||||
<name status="sf24ce6" import="ia857f0" exported="True">Chapter One</name>
|
<name status="sf24ce6" import="ia857f0" exported="True">Chapter One</name>
|
||||||
</item>
|
</item>
|
||||||
<item handle="636b6aa9b697b" parent="e7ded148d6e4a" order="1" type="FILE" class="NOVEL" layout="DOCUMENT">
|
<item handle="636b6aa9b697b" parent="e7ded148d6e4a" root="7031beac91f75" order="1" type="FILE" class="NOVEL" layout="DOCUMENT">
|
||||||
<meta charCount="2429" wordCount="432" paraCount="14" cursorPos="219"/>
|
<meta charCount="2429" wordCount="432" paraCount="14" cursorPos="219"/>
|
||||||
<name status="s90e6c9" import="ia857f0" exported="True">Making a Scene</name>
|
<name status="s90e6c9" import="ia857f0" exported="True">Making a Scene</name>
|
||||||
</item>
|
</item>
|
||||||
<item handle="bc0cbd2a407f3" parent="e7ded148d6e4a" order="2" type="FILE" class="NOVEL" layout="DOCUMENT">
|
<item handle="bc0cbd2a407f3" parent="e7ded148d6e4a" root="7031beac91f75" order="2" type="FILE" class="NOVEL" layout="DOCUMENT">
|
||||||
<meta charCount="476" wordCount="93" paraCount="3" cursorPos="577"/>
|
<meta charCount="476" wordCount="93" paraCount="3" cursorPos="577"/>
|
||||||
<name status="s90e6c9" import="ia857f0" exported="True">Another Scene</name>
|
<name status="s90e6c9" import="ia857f0" exported="True">Another Scene</name>
|
||||||
</item>
|
</item>
|
||||||
<item handle="ba8a28a246524" parent="e7ded148d6e4a" order="3" type="FILE" class="NOVEL" layout="DOCUMENT">
|
<item handle="ba8a28a246524" parent="e7ded148d6e4a" root="7031beac91f75" order="3" type="FILE" class="NOVEL" layout="DOCUMENT">
|
||||||
<meta charCount="617" wordCount="101" paraCount="3" cursorPos="4"/>
|
<meta charCount="617" wordCount="101" paraCount="3" cursorPos="4"/>
|
||||||
<name status="sf12341" import="ia857f0" exported="True">Interlude</name>
|
<name status="sf12341" import="ia857f0" exported="True">Interlude</name>
|
||||||
</item>
|
</item>
|
||||||
<item handle="96b68994dfa3d" parent="e7ded148d6e4a" order="4" type="FILE" class="NOVEL" layout="NOTE">
|
<item handle="96b68994dfa3d" parent="e7ded148d6e4a" root="7031beac91f75" order="4" type="FILE" class="NOVEL" layout="NOTE">
|
||||||
<meta charCount="1692" wordCount="313" paraCount="6" cursorPos="1110"/>
|
<meta charCount="1692" wordCount="313" paraCount="6" cursorPos="1110"/>
|
||||||
<name status="sd51c5b" import="ia857f0" exported="False">A Note on Structure</name>
|
<name status="sd51c5b" import="ia857f0" exported="False">A Note on Structure</name>
|
||||||
</item>
|
</item>
|
||||||
<item handle="88706ddc78b1b" parent="e7ded148d6e4a" order="5" type="FILE" class="NOVEL" layout="DOCUMENT">
|
<item handle="88706ddc78b1b" parent="e7ded148d6e4a" root="7031beac91f75" order="5" type="FILE" class="NOVEL" layout="DOCUMENT">
|
||||||
<meta charCount="139" wordCount="28" paraCount="1" cursorPos="343"/>
|
<meta charCount="139" wordCount="28" paraCount="1" cursorPos="343"/>
|
||||||
<name status="s90e6c9" import="ia857f0" exported="True">Chapter Two</name>
|
<name status="s90e6c9" import="ia857f0" exported="True">Chapter Two</name>
|
||||||
</item>
|
</item>
|
||||||
<item handle="ae7339df26ded" parent="e7ded148d6e4a" order="6" type="FILE" class="NOVEL" layout="DOCUMENT">
|
<item handle="ae7339df26ded" parent="e7ded148d6e4a" root="7031beac91f75" order="6" type="FILE" class="NOVEL" layout="DOCUMENT">
|
||||||
<meta charCount="189" wordCount="37" paraCount="1" cursorPos="224"/>
|
<meta charCount="189" wordCount="37" paraCount="1" cursorPos="224"/>
|
||||||
<name status="s90e6c9" import="ia857f0" exported="True">We Found John!</name>
|
<name status="s90e6c9" import="ia857f0" exported="True">We Found John!</name>
|
||||||
</item>
|
</item>
|
||||||
<item handle="f6622b4617424" parent="None" order="1" type="ROOT" class="CHARACTER">
|
<item handle="f6622b4617424" parent="None" root="f6622b4617424" order="1" type="ROOT" class="CHARACTER">
|
||||||
<meta expanded="True"/>
|
<meta expanded="True"/>
|
||||||
<name status="sf12341" import="ia857f0">Characters</name>
|
<name status="sf12341" import="ia857f0">Characters</name>
|
||||||
</item>
|
</item>
|
||||||
<item handle="f7e2d9f330615" parent="f6622b4617424" order="0" type="FOLDER" class="CHARACTER">
|
<item handle="f7e2d9f330615" parent="f6622b4617424" root="f6622b4617424" order="0" type="FOLDER" class="CHARACTER">
|
||||||
<meta expanded="True"/>
|
<meta expanded="True"/>
|
||||||
<name status="sf12341" import="ia857f0">Main Characters</name>
|
<name status="sf12341" import="ia857f0">Main Characters</name>
|
||||||
</item>
|
</item>
|
||||||
<item handle="14298de4d9524" parent="f7e2d9f330615" order="0" type="FILE" class="CHARACTER" layout="NOTE">
|
<item handle="14298de4d9524" parent="f7e2d9f330615" root="f6622b4617424" order="0" type="FILE" class="CHARACTER" layout="NOTE">
|
||||||
<meta charCount="49" wordCount="9" paraCount="1" cursorPos="24"/>
|
<meta charCount="49" wordCount="9" paraCount="1" cursorPos="24"/>
|
||||||
<name status="sf12341" import="icfb3a5" exported="True">John Smith</name>
|
<name status="sf12341" import="icfb3a5" exported="True">John Smith</name>
|
||||||
</item>
|
</item>
|
||||||
<item handle="bb2c23b3c42cc" parent="f7e2d9f330615" order="1" type="FILE" class="CHARACTER" layout="NOTE">
|
<item handle="bb2c23b3c42cc" parent="f7e2d9f330615" root="f6622b4617424" order="1" type="FILE" class="CHARACTER" layout="NOTE">
|
||||||
<meta charCount="55" wordCount="9" paraCount="1" cursorPos="25"/>
|
<meta charCount="55" wordCount="9" paraCount="1" cursorPos="25"/>
|
||||||
<name status="sf12341" import="i2d7a54" exported="True">Jane Smith</name>
|
<name status="sf12341" import="i2d7a54" exported="True">Jane Smith</name>
|
||||||
</item>
|
</item>
|
||||||
<item handle="15c4492bd5107" parent="None" order="2" type="ROOT" class="WORLD">
|
<item handle="15c4492bd5107" parent="None" root="15c4492bd5107" order="2" type="ROOT" class="WORLD">
|
||||||
<meta expanded="True"/>
|
<meta expanded="True"/>
|
||||||
<name status="sf12341" import="ia857f0">Locations</name>
|
<name status="sf12341" import="ia857f0">Locations</name>
|
||||||
</item>
|
</item>
|
||||||
<item handle="b3e74dbc1f584" parent="15c4492bd5107" order="0" type="FILE" class="WORLD" layout="NOTE">
|
<item handle="b3e74dbc1f584" parent="15c4492bd5107" root="15c4492bd5107" order="0" type="FILE" class="WORLD" layout="NOTE">
|
||||||
<meta charCount="76" wordCount="15" paraCount="1" cursorPos="20"/>
|
<meta charCount="76" wordCount="15" paraCount="1" cursorPos="20"/>
|
||||||
<name status="sf12341" import="i56be10" exported="True">Earth</name>
|
<name status="sf12341" import="i56be10" exported="True">Earth</name>
|
||||||
</item>
|
</item>
|
||||||
<item handle="f1471bef9f2ae" parent="15c4492bd5107" order="1" type="FILE" class="WORLD" layout="NOTE">
|
<item handle="f1471bef9f2ae" parent="15c4492bd5107" root="15c4492bd5107" order="1" type="FILE" class="WORLD" layout="NOTE">
|
||||||
<meta charCount="115" wordCount="24" paraCount="1" cursorPos="133"/>
|
<meta charCount="115" wordCount="24" paraCount="1" cursorPos="133"/>
|
||||||
<name status="sf12341" import="icfb3a5" exported="True">Space</name>
|
<name status="sf12341" import="icfb3a5" exported="True">Space</name>
|
||||||
</item>
|
</item>
|
||||||
<item handle="5eaea4e8cdee8" parent="15c4492bd5107" order="2" type="FILE" class="WORLD" layout="NOTE">
|
<item handle="5eaea4e8cdee8" parent="15c4492bd5107" root="15c4492bd5107" order="2" type="FILE" class="WORLD" layout="NOTE">
|
||||||
<meta charCount="28" wordCount="6" paraCount="1" cursorPos="45"/>
|
<meta charCount="28" wordCount="6" paraCount="1" cursorPos="45"/>
|
||||||
<name status="sf12341" import="i2d7a54" exported="True">Mars</name>
|
<name status="sf12341" import="i2d7a54" exported="True">Mars</name>
|
||||||
</item>
|
</item>
|
||||||
<item handle="6827118336ac1" parent="None" order="3" type="ROOT" class="ARCHIVE">
|
<item handle="6827118336ac1" parent="None" root="6827118336ac1" order="3" type="ROOT" class="ARCHIVE">
|
||||||
<meta expanded="True"/>
|
<meta expanded="True"/>
|
||||||
<name status="sf12341" import="ia857f0">Archive</name>
|
<name status="sf12341" import="ia857f0">Archive</name>
|
||||||
</item>
|
</item>
|
||||||
<item handle="ae9bf3c3ea159" parent="6827118336ac1" order="0" type="FOLDER" class="ARCHIVE">
|
<item handle="ae9bf3c3ea159" parent="6827118336ac1" root="6827118336ac1" order="0" type="FOLDER" class="ARCHIVE">
|
||||||
<meta expanded="True"/>
|
<meta expanded="True"/>
|
||||||
<name status="sf12341" import="ia857f0">Scenes</name>
|
<name status="sf12341" import="ia857f0">Scenes</name>
|
||||||
</item>
|
</item>
|
||||||
<item handle="8a5deb88c0e97" parent="ae9bf3c3ea159" order="0" type="FILE" class="NOVEL" layout="DOCUMENT">
|
<item handle="8a5deb88c0e97" parent="ae9bf3c3ea159" root="6827118336ac1" order="0" type="FILE" class="ARCHIVE" layout="DOCUMENT">
|
||||||
<meta charCount="315" wordCount="55" paraCount="1" cursorPos="322"/>
|
<meta charCount="315" wordCount="55" paraCount="1" cursorPos="322"/>
|
||||||
<name status="s90e6c9" import="ia857f0" exported="True">Old File</name>
|
<name status="s90e6c9" import="ia857f0" exported="True">Old File</name>
|
||||||
</item>
|
</item>
|
||||||
<item handle="98acd8c76c93a" parent="None" order="4" type="TRASH" class="TRASH">
|
<item handle="98acd8c76c93a" parent="None" root="98acd8c76c93a" order="4" type="TRASH" class="TRASH">
|
||||||
<meta expanded="True"/>
|
<meta expanded="True"/>
|
||||||
<name status="sf12341" import="ia857f0">Trash</name>
|
<name status="sf12341" import="ia857f0">Trash</name>
|
||||||
</item>
|
</item>
|
||||||
<item handle="b8136a5a774a0" parent="98acd8c76c93a" order="0" type="FILE" class="NOVEL" layout="DOCUMENT">
|
<item handle="b8136a5a774a0" parent="98acd8c76c93a" root="98acd8c76c93a" order="0" type="FILE" class="TRASH" layout="DOCUMENT">
|
||||||
<meta charCount="30" wordCount="6" paraCount="1" cursorPos="36"/>
|
<meta charCount="30" wordCount="6" paraCount="1" cursorPos="36"/>
|
||||||
<name status="sf12341" import="ia857f0" exported="True">Delete Me!</name>
|
<name status="sf12341" import="ia857f0" exported="True">Delete Me!</name>
|
||||||
</item>
|
</item>
|
||||||
|
|||||||
@@ -126,8 +126,6 @@ def testCoreTree_BuildTree(mockGUI, mockItems):
|
|||||||
|
|
||||||
# Check for archive and trash folders
|
# Check for archive and trash folders
|
||||||
assert theTree.trashRoot() is None
|
assert theTree.trashRoot() is None
|
||||||
assert theTree.archiveRoot() is None
|
|
||||||
assert theTree.isTrashRoot("a000000000003") is False
|
|
||||||
|
|
||||||
aHandles = []
|
aHandles = []
|
||||||
for tHandle, pHandle, nwItem in mockItems:
|
for tHandle, pHandle, nwItem in mockItems:
|
||||||
@@ -152,8 +150,8 @@ def testCoreTree_BuildTree(mockGUI, mockItems):
|
|||||||
|
|
||||||
# Check that we have the correct archive and trash folders
|
# Check that we have the correct archive and trash folders
|
||||||
assert theTree.trashRoot() == "a000000000003"
|
assert theTree.trashRoot() == "a000000000003"
|
||||||
assert theTree.archiveRoot() == "a000000000002"
|
assert theTree.findRoot(nwItemClass.ARCHIVE) == "a000000000002"
|
||||||
assert theTree.isTrashRoot("a000000000003") is True
|
assert theTree.isTrash("a000000000003") is True
|
||||||
assert theTree.isRoot("a000000000002") is True
|
assert theTree.isRoot("a000000000002") is True
|
||||||
|
|
||||||
# Check the isTrash function
|
# Check the isTrash function
|
||||||
@@ -221,7 +219,6 @@ def testCoreTree_BuildTree(mockGUI, mockItems):
|
|||||||
del theTree["a000000000002"]
|
del theTree["a000000000002"]
|
||||||
assert len(theTree) == len(mockItems) - 2
|
assert len(theTree) == len(mockItems) - 2
|
||||||
assert "a000000000002" not in theTree
|
assert "a000000000002" not in theTree
|
||||||
assert theTree.archiveRoot() is None
|
|
||||||
|
|
||||||
del theTree["a000000000003"]
|
del theTree["a000000000003"]
|
||||||
assert len(theTree) == len(mockItems) - 3
|
assert len(theTree) == len(mockItems) - 3
|
||||||
|
|||||||
Reference in New Issue
Block a user