Added filters to timeline view GUI

This commit is contained in:
Veronica K. B. Olsen
2019-10-21 20:57:46 +02:00
parent 3aa07e9b33
commit 1434c2bdf3
5 changed files with 119 additions and 21 deletions
+15 -2
View File
@@ -319,18 +319,24 @@ class NWIndex():
return True
def buildTagNovelMap(self, theTags):
def buildTagNovelMap(self, theTags, theFilters=None):
tagMap = {}
tagClass = {}
exClass = []
if theFilters is not None:
if "exClass" in theFilters.keys():
exClass = theFilters["exClass"]
for theTag in theTags:
tagMap[theTag] = [0]*len(self.novelOrder)
try:
tagClass[theTag] = nwItemClass[self.tagIndex[theTag][2]]
except:
logger.error("Could not map '%s' to nwItemClass" % self.tagIndex[theTag][2])
tagClass[theTag] = None
if tagClass[theTag] not in exClass:
tagMap[theTag] = [0]*len(self.novelOrder)
for tHandle in self.refIndex:
for nLine, tKey, tTag, nTitle in self.refIndex[tHandle]:
@@ -342,6 +348,13 @@ class NWIndex():
except:
logger.error("Could not find '%s:%d' in novelOrder" % (tHandle, nTitle))
if theFilters["hUnused"]:
tagMapFiltered = {}
for theTag in tagMap.keys():
if sum(tagMap[theTag]) > 0:
tagMapFiltered[theTag] = tagMap[theTag]
return tagMapFiltered
return tagMap
# END Class NWIndex