Some minor imrpovements

This commit is contained in:
Veronica K. B. Olsen
2019-11-17 16:23:18 +01:00
parent d533d91adc
commit cff0d86d90
2 changed files with 18 additions and 19 deletions
+2 -2
View File
@@ -60,7 +60,7 @@ class GuiProjectOutline(QWidget):
I_CCOUNT : "Chars", I_CCOUNT : "Chars",
I_PCOUNT : "Pars", I_PCOUNT : "Pars",
I_SYNOP : "Synopsis", I_SYNOP : "Synopsis",
I_POV : nwLabels.KEY_NAME[nwKeyWords.POV_KEY], I_POV : "POV",
I_CHAR : nwLabels.KEY_NAME[nwKeyWords.CHAR_KEY], I_CHAR : nwLabels.KEY_NAME[nwKeyWords.CHAR_KEY],
I_PLOT : nwLabels.KEY_NAME[nwKeyWords.PLOT_KEY], I_PLOT : nwLabels.KEY_NAME[nwKeyWords.PLOT_KEY],
I_TIME : nwLabels.KEY_NAME[nwKeyWords.TIME_KEY], I_TIME : nwLabels.KEY_NAME[nwKeyWords.TIME_KEY],
@@ -118,7 +118,7 @@ class GuiProjectOutline(QWidget):
for titleKey in self.theIndex.getNovelStructure(): for titleKey in self.theIndex.getNovelStructure():
if len(titleKey) < 15: if len(titleKey) < 16:
continue continue
tHandle = titleKey[:13] tHandle = titleKey[:13]
+16 -17
View File
@@ -140,7 +140,7 @@ class NWIndex():
indexFile = path.join(self.theProject.projMeta, nwFiles.INDEX_FILE) indexFile = path.join(self.theProject.projMeta, nwFiles.INDEX_FILE)
logger.debug("Saving index and meta files") logger.debug("Saving index file")
if self.mainConf.debugInfo: if self.mainConf.debugInfo:
nIndent = 2 nIndent = 2
else: else:
@@ -251,7 +251,6 @@ class NWIndex():
nLine = 0 nLine = 0
nTitle = 0 nTitle = 0
sTitle = None
theLines = theText.splitlines() theLines = theText.splitlines()
for aLine in theLines: for aLine in theLines:
aLine = aLine aLine = aLine
@@ -495,7 +494,7 @@ class NWIndex():
return theStructure return theStructure
def getCounts(self, tHandle, nTitle=None): def getCounts(self, tHandle, sTitle=None):
"""Returns the counts for a file, or a section of a file """Returns the counts for a file, or a section of a file
starting at title nTitle. starting at title nTitle.
""" """
@@ -504,28 +503,28 @@ class NWIndex():
wC = 0 wC = 0
pC = 0 pC = 0
if nTitle is None: if sTitle is None:
if tHandle in self.textCounts: if tHandle in self.textCounts:
cC = self.textCounts[tHandle][0] cC = self.textCounts[tHandle][0]
wC = self.textCounts[tHandle][1] wC = self.textCounts[tHandle][1]
pC = self.textCounts[tHandle][2] pC = self.textCounts[tHandle][2]
else: else:
if tHandle in self.novelIndex: if tHandle in self.novelIndex:
if nTitle in self.novelIndex[tHandle]: if sTitle in self.novelIndex[tHandle]:
cC = self.novelIndex[tHandle][nTitle]["cCount"] cC = self.novelIndex[tHandle][sTitle]["cCount"]
wC = self.novelIndex[tHandle][nTitle]["wCount"] wC = self.novelIndex[tHandle][sTitle]["wCount"]
pC = self.novelIndex[tHandle][nTitle]["pCount"] pC = self.novelIndex[tHandle][sTitle]["pCount"]
elif tHandle in self.noteIndex: elif tHandle in self.noteIndex:
if nTitle in self.noteIndex[tHandle]: if sTitle in self.noteIndex[tHandle]:
cC = self.noteIndex[tHandle][nTitle]["cCount"] cC = self.noteIndex[tHandle][sTitle]["cCount"]
wC = self.noteIndex[tHandle][nTitle]["wCount"] wC = self.noteIndex[tHandle][sTitle]["wCount"]
pC = self.noteIndex[tHandle][nTitle]["pCount"] pC = self.noteIndex[tHandle][sTitle]["pCount"]
return cC, wC, pC return cC, wC, pC
def getReferences(self, tHandle, tTitle=None): def getReferences(self, tHandle, sTitle=None):
"""Extract all references made in a file, and optionally title """Extract all references made in a file, and optionally title
section. tTitle must be a string. section. sTitle must be a string.
""" """
theRefs = {} theRefs = {}
@@ -536,9 +535,9 @@ class NWIndex():
return theRefs return theRefs
try: try:
for sTitle in self.refIndex[tHandle]: for refTitle in self.refIndex[tHandle]:
for nLine, tKey, tTag in self.refIndex[tHandle][sTitle]["tags"]: for nLine, tKey, tTag in self.refIndex[tHandle][refTitle]["tags"]:
if tTitle is None or tTitle == sTitle: if sTitle is None or sTitle == refTitle:
theRefs[tKey].append(tTag) theRefs[tKey].append(tTag)
except Exception as e: except Exception as e:
logger.error("Failed to generate reference list") logger.error("Failed to generate reference list")