Added some useful menu option, and settings in project file

This commit is contained in:
Veronica K. B. Olsen
2020-04-13 16:02:44 +02:00
parent ac3adade18
commit 92f54af894
6 changed files with 98 additions and 5 deletions
+25
View File
@@ -63,6 +63,11 @@ class NWIndex():
self.noteIndex = None
self.textCounts = None
# TimeStamps
self.timeNovel = 0
self.timeNote = 0
self.timeIndex = 0
self.clearIndex()
return
@@ -72,14 +77,21 @@ class NWIndex():
##
def clearIndex(self):
"""Clear the index dictionaries and time stamps.
"""
self.tagIndex = {}
self.refIndex = {}
self.novelIndex = {}
self.noteIndex = {}
self.textCounts = {}
self.timeNovel = 0
self.timeNote = 0
self.timeIndex = 0
return
def deleteHandle(self, tHandle):
"""Delete all entries of a given document handle.
"""
delTags = []
for tTag in self.tagIndex:
@@ -129,6 +141,11 @@ class NWIndex():
if "textCounts" in theData.keys():
self.textCounts = theData["textCounts"]
nowTime = time()
self.timeNovel = nowTime
self.timeNote = nowTime
self.timeIndex = nowTime
self.checkIndex()
return True
@@ -289,6 +306,14 @@ class NWIndex():
cC, wC, pC = countWords(theText)
self.textCounts[tHandle] = [cC, wC, pC]
# Update timestamps for index changes
nowTime = time()
self.timeIndex = nowTime
if isNovel:
self.timeNovel = nowTime
else:
self.timeNote = nowTime
return True
def indexTitle(self, tHandle, isNovel, aLine, nLine, itemLayout):