Fixed alert for orphaned items, and fixed setting item depth.

This commit is contained in:
Veronica K. B. Olsen
2019-05-04 11:54:24 +02:00
parent 92da5a335b
commit 6331125b0c
3 changed files with 10 additions and 9 deletions
+1
View File
@@ -292,6 +292,7 @@ class GuiDocTree(QTreeWidget):
return
pHandle = trItemP.text(self.C_HANDLE)
nwItemS.setParent(pHandle)
nwItemS.setDepth(self.theProject.countItemDepth(tHandle))
self.setTreeItemValues(tHandle)
return
+3 -3
View File
@@ -345,7 +345,7 @@ class NWProject():
# Report status
if len(orphanFiles) > 0:
logger.warning("Found %d orphaned file(s) in project folder!" % len(orphanFiles))
self.theParent.makeAlert("Found %d orphaned file(s) in project folder!" % len(orphanFiles),1)
else:
logger.verbose("File check OK")
return
@@ -363,7 +363,7 @@ class NWProject():
return
def _countItemDepth(self, tHandle):
def countItemDepth(self, tHandle):
theDepth = 0
nwItem = self.getItem(tHandle)
while nwItem.parHandle is not None:
@@ -390,7 +390,7 @@ class NWProject():
logger.verbose("Entry %s is a root item" % str(tHandle))
self.treeRoots.append(tHandle)
itemDepth = self._countItemDepth(tHandle)
itemDepth = self.countItemDepth(tHandle)
if itemDepth is None:
logger.error("The depth of entry %s could not be determined" % tHandle)
else:
+6 -6
View File
@@ -1,5 +1,5 @@
<?xml version='1.0' encoding='utf-8'?>
<novelWriterXML appVersion="0.0.1" fileVersion="1.0" timeStamp="2019-05-03 22:26:20">
<novelWriterXML appVersion="0.0.1" fileVersion="1.0" timeStamp="2019-05-04 11:53:50">
<project>
<name>Sample Project</name>
<title>Sample Project</title>
@@ -47,7 +47,7 @@
<children>False</children>
<expanded>False</expanded>
<layout>SCENE</layout>
<charCount>2575</charCount>
<charCount>2571</charCount>
<wordCount>377</wordCount>
<paraCount>5</paraCount>
</item>
@@ -69,7 +69,7 @@
<type>FILE</type>
<class>NOVEL</class>
<status>0</status>
<depth>1</depth>
<depth>2</depth>
<children>False</children>
<expanded>False</expanded>
<layout>SCENE</layout>
@@ -92,7 +92,7 @@
<class>CHARACTER</class>
<status>0</status>
<depth>1</depth>
<children>False</children>
<children>True</children>
<expanded>True</expanded>
</item>
<item handle="14298de4d9524" order="0" parent="f7e2d9f330615">
@@ -100,7 +100,7 @@
<type>FILE</type>
<class>CHARACTER</class>
<status>0</status>
<depth>1</depth>
<depth>2</depth>
<children>False</children>
<expanded>False</expanded>
<layout>NOTE</layout>
@@ -113,7 +113,7 @@
<type>FILE</type>
<class>CHARACTER</class>
<status>0</status>
<depth>1</depth>
<depth>2</depth>
<children>False</children>
<expanded>False</expanded>
<layout>NOTE</layout>