Restructure the record of root items in the tree class

This commit is contained in:
Veronica Berglyd Olsen
2022-04-02 19:13:54 +02:00
parent 8ddda4783d
commit f9ddcd2f8a
7 changed files with 66 additions and 33 deletions
@@ -1,5 +1,5 @@
<?xml version='1.0' encoding='utf-8'?>
<novelWriterXML appVersion="1.7-alpha0" hexVersion="0x010700a0" fileVersion="1.4" timeStamp="2022-02-17 21:57:32">
<novelWriterXML appVersion="1.7-alpha0" hexVersion="0x010700a0" fileVersion="1.4" timeStamp="2022-04-02 18:36:55">
<project>
<name>New Project</name>
<title></title>
@@ -39,7 +39,7 @@
<entry blue="0" green="200" red="50">Main</entry>
</importance>
</settings>
<content count="12">
<content count="16">
<item handle="73475cb40a568" parent="None" order="0" type="ROOT" class="NOVEL">
<meta expanded="False"/>
<name status="New">Novel</name>
@@ -72,19 +72,35 @@
<meta charCount="0" wordCount="0" paraCount="0" cursorPos="0"/>
<name status="New" exported="True">New Scene</name>
</item>
<item handle="1a6562590ef19" parent="None" order="0" type="ROOT" class="TIMELINE">
<item handle="1a6562590ef19" parent="None" order="0" type="ROOT" class="NOVEL">
<meta expanded="False"/>
<name status="New">Novel</name>
</item>
<item handle="031b4af5197ec" parent="None" order="0" type="ROOT" class="PLOT">
<meta expanded="False"/>
<name status="New">Plot</name>
</item>
<item handle="41cfc0d1f2d12" parent="None" order="0" type="ROOT" class="CHARACTER">
<meta expanded="False"/>
<name status="New">Character</name>
</item>
<item handle="2858dcd1057d3" parent="None" order="0" type="ROOT" class="WORLD">
<meta expanded="False"/>
<name status="New">World</name>
</item>
<item handle="2fca346db6561" parent="None" order="0" type="ROOT" class="TIMELINE">
<meta expanded="False"/>
<name status="New">Timeline</name>
</item>
<item handle="031b4af5197ec" parent="None" order="0" type="ROOT" class="OBJECT">
<item handle="02d20bbd7e394" parent="None" order="0" type="ROOT" class="OBJECT">
<meta expanded="False"/>
<name status="New">Object</name>
</item>
<item handle="41cfc0d1f2d12" parent="None" order="0" type="ROOT" class="CUSTOM">
<item handle="7688b6ef52555" parent="None" order="0" type="ROOT" class="CUSTOM">
<meta expanded="False"/>
<name status="New">Custom1</name>
</item>
<item handle="2858dcd1057d3" parent="None" order="0" type="ROOT" class="CUSTOM">
<item handle="c837649cce43f" parent="None" order="0" type="ROOT" class="CUSTOM">
<meta expanded="False"/>
<name status="New">Custom2</name>
</item>
+1
View File
@@ -284,6 +284,7 @@ def testCoreIndex_ScanText(nwMinimal, mockGUI):
aHandle = theProject.newRoot("Archive", nwItemClass.ARCHIVE)
assert theProject.projTree[aHandle] is not None
xItem.setParent(aHandle)
xItem.setRoot(aHandle)
assert theIndex.scanText(xHandle, "Hello World!") is False
# Make some usable items
-7
View File
@@ -224,17 +224,10 @@ def testCoreTree_Methods(mockGUI, mockItems):
assert theTree.checkType("c000000000001", nwItemType.FILE) is True
# Root item lookup
theTree._treeRoots.append("stuff")
assert theTree.findRoot(nwItemClass.WORLD) is None
assert theTree.findRoot(nwItemClass.NOVEL) == "a000000000001"
assert theTree.findRoot(nwItemClass.CHARACTER) == "a000000000004"
# Find root item of child item
assert theTree.getRootItem("b000000000001").itemHandle == "a000000000001"
assert theTree.getRootItem("c000000000001").itemHandle == "a000000000001"
assert theTree.getRootItem("c000000000002").itemHandle == "a000000000001"
assert theTree.getRootItem("stuff") is None
# Get item path
assert theTree.getItemPath("stuff") == []
assert theTree.getItemPath("c000000000001") == [