From 83a9c6660fb05b1d153108e7cd01b2759ad9960e Mon Sep 17 00:00:00 2001 From: "Veronica K. B. Olsen" Date: Sat, 18 May 2019 13:39:15 +0200 Subject: [PATCH] Added cursor position to item class. --- nw/project/item.py | 11 ++++++++++- 1 file changed, 10 insertions(+), 1 deletion(-) diff --git a/nw/project/item.py b/nw/project/item.py index b41342c9..7ea631ac 100644 --- a/nw/project/item.py +++ b/nw/project/item.py @@ -38,9 +38,11 @@ class NWItem(): self.itemStatus = 0 self.isExpanded = False + # Document Meta Data self.charCount = 0 self.wordCount = 0 self.paraCount = 0 + self.cursorPos = 0 return @@ -64,6 +66,7 @@ class NWItem(): xSub = self._subPack(xPack,"charCount", text=str(self.charCount), none=False) xSub = self._subPack(xPack,"wordCount", text=str(self.wordCount), none=False) xSub = self._subPack(xPack,"paraCount", text=str(self.paraCount), none=False) + xSub = self._subPack(xPack,"cursorPos", text=str(self.cursorPos), none=False) return xPack def _subPack(self, xParent, name, attrib=None, text=None, none=True): @@ -90,6 +93,7 @@ class NWItem(): elif tagName == "charCount": self.setCharCount(tagValue) elif tagName == "wordCount": self.setWordCount(tagValue) elif tagName == "paraCount": self.setParaCount(tagValue) + elif tagName == "cursorPos": self.setCursorPos(tagValue) else: logger.error("Unknown tag '%s'" % tagName) return @@ -166,7 +170,7 @@ class NWItem(): return ## - # Set Stats + # Set Document Meta Data ## def setCharCount(self, theCount): @@ -184,4 +188,9 @@ class NWItem(): self.paraCount = theCount return + def setCursorPos(self, thePosition): + thePosition = checkInt(thePosition,0) + self.cursorPos = thePosition + return + # END Class NWItem