Make some minor improvements to how expanded status is saved for items
This commit is contained in:
@@ -825,6 +825,7 @@ class GuiProjectTree(QTreeWidget):
|
|||||||
# is updated accordingly, and update word count
|
# is updated accordingly, and update word count
|
||||||
pHandle = trItemP.data(self.C_NAME, Qt.UserRole)
|
pHandle = trItemP.data(self.C_NAME, Qt.UserRole)
|
||||||
nwItemS.setParent(pHandle)
|
nwItemS.setParent(pHandle)
|
||||||
|
trItemP.setExpanded(True)
|
||||||
logger.debug("The parent of item '%s' has been changed to '%s'", tHandle, pHandle)
|
logger.debug("The parent of item '%s' has been changed to '%s'", tHandle, pHandle)
|
||||||
|
|
||||||
mHandles = self.getTreeFromHandle(tHandle)
|
mHandles = self.getTreeFromHandle(tHandle)
|
||||||
@@ -873,12 +874,17 @@ class GuiProjectTree(QTreeWidget):
|
|||||||
starting at a given QTreeWidgetItem.
|
starting at a given QTreeWidgetItem.
|
||||||
"""
|
"""
|
||||||
tHandle = tItem.data(self.C_NAME, Qt.UserRole)
|
tHandle = tItem.data(self.C_NAME, Qt.UserRole)
|
||||||
|
cCount = tItem.childCount()
|
||||||
|
|
||||||
|
# Update tree-related meta data
|
||||||
nwItem = self.theProject.projTree[tHandle]
|
nwItem = self.theProject.projTree[tHandle]
|
||||||
nwItem.setExpanded(tItem.isExpanded())
|
nwItem.setExpanded(tItem.isExpanded() and cCount > 0)
|
||||||
nwItem.setOrder(tIndex)
|
nwItem.setOrder(tIndex)
|
||||||
|
|
||||||
theList.append(tHandle)
|
theList.append(tHandle)
|
||||||
for i in range(tItem.childCount()):
|
for i in range(cCount):
|
||||||
self._scanChildren(theList, tItem.child(i), i)
|
self._scanChildren(theList, tItem.child(i), i)
|
||||||
|
|
||||||
return theList
|
return theList
|
||||||
|
|
||||||
def _addTreeItem(self, nwItem, nHandle=None):
|
def _addTreeItem(self, nwItem, nHandle=None):
|
||||||
|
|||||||
@@ -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-23 18:59:25">
|
<novelWriterXML appVersion="1.7-alpha0" hexVersion="0x010700a0" fileVersion="1.4" timeStamp="2022-04-23 19:31:12">
|
||||||
<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>1323</saveCount>
|
<saveCount>1327</saveCount>
|
||||||
<autoCount>207</autoCount>
|
<autoCount>207</autoCount>
|
||||||
<editTime>66237</editTime>
|
<editTime>66285</editTime>
|
||||||
</project>
|
</project>
|
||||||
<settings>
|
<settings>
|
||||||
<doBackup>False</doBackup>
|
<doBackup>False</doBackup>
|
||||||
@@ -74,7 +74,7 @@
|
|||||||
<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="6a2d6d5f4f401" root="7031beac91f75" order="0" type="FILE" class="NOVEL" layout="DOCUMENT">
|
<item handle="636b6aa9b697b" parent="6a2d6d5f4f401" root="7031beac91f75" order="0" type="FILE" class="NOVEL" layout="DOCUMENT">
|
||||||
<meta expanded="True" charCount="2429" wordCount="432" paraCount="14" cursorPos="1479"/>
|
<meta expanded="False" charCount="2429" wordCount="432" paraCount="14" cursorPos="1479"/>
|
||||||
<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="6a2d6d5f4f401" root="7031beac91f75" order="1" type="FILE" class="NOVEL" layout="DOCUMENT">
|
<item handle="bc0cbd2a407f3" parent="6a2d6d5f4f401" root="7031beac91f75" order="1" type="FILE" class="NOVEL" layout="DOCUMENT">
|
||||||
|
|||||||
@@ -85,7 +85,7 @@
|
|||||||
<name status="s000000" import="i000004" exported="True">New Note</name>
|
<name status="s000000" import="i000004" exported="True">New Note</name>
|
||||||
</item>
|
</item>
|
||||||
<item handle="0000000000024" parent="None" root="0000000000024" order="4" type="ROOT" class="TRASH">
|
<item handle="0000000000024" parent="None" root="0000000000024" order="4" type="ROOT" class="TRASH">
|
||||||
<meta expanded="True"/>
|
<meta expanded="False"/>
|
||||||
<name status="s000000" import="i000004">Trash</name>
|
<name status="s000000" import="i000004">Trash</name>
|
||||||
</item>
|
</item>
|
||||||
</content>
|
</content>
|
||||||
|
|||||||
Reference in New Issue
Block a user