Add novel data extraction function to index

This commit is contained in:
Veronica K. B. Olsen
2021-01-02 22:22:05 +01:00
parent a57e8f3a5d
commit acb6f1fc87
3 changed files with 17 additions and 7 deletions
+8
View File
@@ -611,6 +611,14 @@ class NWIndex():
return theRefs
def getNovelData(self, tHandle, sTitle):
"""Return the novel data of a given handle and title.
"""
if tHandle in self.novelIndex:
if sTitle in self.novelIndex[tHandle]:
return self.novelIndex[tHandle][sTitle]
return None
def getBackReferenceList(self, tHandle):
"""Build a list of files referring back to our file, specified
by tHandle.
+4 -5
View File
@@ -271,11 +271,10 @@ class GuiOutlineDetails(QScrollArea):
"""Update the content of the tree with the given handle and line
number pointing to a header.
"""
try:
nwItem = self.theProject.projTree[tHandle]
novIdx = self.theIndex.novelIndex[tHandle][sTitle]
theRefs = self.theIndex.getReferences(tHandle, sTitle)
except Exception:
nwItem = self.theProject.projTree[tHandle]
novIdx = self.theIndex.getNovelData(tHandle, sTitle)
theRefs = self.theIndex.getReferences(tHandle, sTitle)
if nwItem is None or novIdx is None or theRefs == {}:
return False
if novIdx["level"] in self.LVL_MAP: