Drop the total word count value in the XML and rewrite how counts are handled
This commit is contained in:
+34
-34
@@ -544,7 +544,7 @@ class NWProject(QObject):
|
|||||||
|
|
||||||
# Update recent projects
|
# Update recent projects
|
||||||
self.mainConf.updateRecentCache(
|
self.mainConf.updateRecentCache(
|
||||||
self.projPath, self._data.name, self._data.getLastCount("total"), time()
|
self.projPath, self._data.name, sum(self._data.initCounts), time()
|
||||||
)
|
)
|
||||||
self.mainConf.saveRecentCache()
|
self.mainConf.saveRecentCache()
|
||||||
|
|
||||||
@@ -611,7 +611,7 @@ class NWProject(QObject):
|
|||||||
|
|
||||||
# Update recent projects
|
# Update recent projects
|
||||||
self.mainConf.updateRecentCache(
|
self.mainConf.updateRecentCache(
|
||||||
self.projPath, self._data.name, self._data.getCurrCount("total"), saveTime
|
self.projPath, self._data.name, sum(self._data.currCounts), saveTime
|
||||||
)
|
)
|
||||||
self.mainConf.saveRecentCache()
|
self.mainConf.saveRecentCache()
|
||||||
|
|
||||||
@@ -949,10 +949,8 @@ class NWProject(QObject):
|
|||||||
def updateWordCounts(self):
|
def updateWordCounts(self):
|
||||||
"""Update the total word count values.
|
"""Update the total word count values.
|
||||||
"""
|
"""
|
||||||
wcNovel, wcNotes = self._projTree.sumWords()
|
novel, notes = self._projTree.sumWords()
|
||||||
self._data.setCurrCount(wcNovel, "novel")
|
self._data.setCurrCounts(novel=novel, notes=notes)
|
||||||
self._data.setCurrCount(wcNotes, "notes")
|
|
||||||
self._data.setCurrCount(wcNovel + wcNotes, "total")
|
|
||||||
return
|
return
|
||||||
|
|
||||||
def countStatus(self):
|
def countStatus(self):
|
||||||
@@ -1211,9 +1209,10 @@ class NWProject(QObject):
|
|||||||
isFile = os.path.isfile(sessionFile)
|
isFile = os.path.isfile(sessionFile)
|
||||||
|
|
||||||
nowTime = time()
|
nowTime = time()
|
||||||
lastCount = self._data.getLastCount("total")
|
iNovel, iNotes = self._data.initCounts
|
||||||
currCount = self._data.getCurrCount("total")
|
cNovel, cNotes = self._data.currCounts
|
||||||
sessDiff = currCount - lastCount
|
iTotal = iNovel + iNotes
|
||||||
|
sessDiff = cNovel + cNotes - iTotal
|
||||||
sessTime = nowTime - self._projOpened
|
sessTime = nowTime - self._projOpened
|
||||||
|
|
||||||
logger.info("The session lasted %d sec and added %d words", int(sessTime), sessDiff)
|
logger.info("The session lasted %d sec and added %d words", int(sessTime), sessDiff)
|
||||||
@@ -1225,8 +1224,8 @@ class NWProject(QObject):
|
|||||||
with open(sessionFile, mode="a+", encoding="utf-8") as outFile:
|
with open(sessionFile, mode="a+", encoding="utf-8") as outFile:
|
||||||
if not isFile:
|
if not isFile:
|
||||||
# It's a new file, so add a header
|
# It's a new file, so add a header
|
||||||
if lastCount > 0:
|
if iTotal > 0:
|
||||||
outFile.write("# Offset %d\n" % lastCount)
|
outFile.write("# Offset %d\n" % iTotal)
|
||||||
outFile.write("# %-17s %-19s %8s %8s %8s\n" % (
|
outFile.write("# %-17s %-19s %8s %8s %8s\n" % (
|
||||||
"Start Time", "End Time", "Novel", "Notes", "Idle"
|
"Start Time", "End Time", "Novel", "Notes", "Idle"
|
||||||
))
|
))
|
||||||
@@ -1234,8 +1233,8 @@ class NWProject(QObject):
|
|||||||
outFile.write("%-19s %-19s %8d %8d %8d\n" % (
|
outFile.write("%-19s %-19s %8d %8d %8d\n" % (
|
||||||
formatTimeStamp(self._projOpened),
|
formatTimeStamp(self._projOpened),
|
||||||
formatTimeStamp(nowTime),
|
formatTimeStamp(nowTime),
|
||||||
self._data.getCurrCount("novel"),
|
cNovel,
|
||||||
self._data.getCurrCount("notes"),
|
cNotes,
|
||||||
int(idleTime),
|
int(idleTime),
|
||||||
))
|
))
|
||||||
|
|
||||||
@@ -1341,8 +1340,8 @@ class NWProjectData:
|
|||||||
self._spellLang = None
|
self._spellLang = None
|
||||||
|
|
||||||
# Project Dictionaries
|
# Project Dictionaries
|
||||||
self._lastCount: dict[str, int] = {}
|
self._initCounts = [0, 0]
|
||||||
self._currCount: dict[str, int] = {}
|
self._currCounts = [0, 0]
|
||||||
self._lastHandle: dict[str, str | None] = {
|
self._lastHandle: dict[str, str | None] = {
|
||||||
"editor": None,
|
"editor": None,
|
||||||
"viewer": None,
|
"viewer": None,
|
||||||
@@ -1407,6 +1406,14 @@ class NWProjectData:
|
|||||||
def spellLang(self):
|
def spellLang(self):
|
||||||
return self._spellLang
|
return self._spellLang
|
||||||
|
|
||||||
|
@property
|
||||||
|
def initCounts(self):
|
||||||
|
return tuple(self._initCounts)
|
||||||
|
|
||||||
|
@property
|
||||||
|
def currCounts(self):
|
||||||
|
return tuple(self._currCounts)
|
||||||
|
|
||||||
@property
|
@property
|
||||||
def lastHandle(self):
|
def lastHandle(self):
|
||||||
return self._lastHandle
|
return self._lastHandle
|
||||||
@@ -1461,16 +1468,6 @@ class NWProjectData:
|
|||||||
"""
|
"""
|
||||||
return self._lastHandle.get(component, None)
|
return self._lastHandle.get(component, None)
|
||||||
|
|
||||||
def getLastCount(self, type):
|
|
||||||
"""Retrieve the last word count for a given type.
|
|
||||||
"""
|
|
||||||
return self._lastCount.get(type, 0)
|
|
||||||
|
|
||||||
def getCurrCount(self, type):
|
|
||||||
"""Retrieve the current word count for a given type.
|
|
||||||
"""
|
|
||||||
return self._currCount.get(type, 0)
|
|
||||||
|
|
||||||
def getTitleFormat(self, kind):
|
def getTitleFormat(self, kind):
|
||||||
"""Retrieve the title format string for a given kind of header.
|
"""Retrieve the title format string for a given kind of header.
|
||||||
"""
|
"""
|
||||||
@@ -1580,19 +1577,22 @@ class NWProjectData:
|
|||||||
self.theProject.setProjectChanged(True)
|
self.theProject.setProjectChanged(True)
|
||||||
return
|
return
|
||||||
|
|
||||||
def setLastCount(self, value, type):
|
def setInitCounts(self, novel=None, notes=None):
|
||||||
"""Set the word counts from last session.
|
"""Set the worc count totals for novel and note files.
|
||||||
"""
|
"""
|
||||||
self._lastCount[type] = checkInt(value, 0)
|
if novel is not None:
|
||||||
self.theProject.setProjectChanged(True)
|
self._initCounts[0] = checkInt(novel, 0)
|
||||||
|
if notes is not None:
|
||||||
|
self._initCounts[1] = checkInt(notes, 0)
|
||||||
return
|
return
|
||||||
|
|
||||||
def setCurrCount(self, value, type):
|
def setCurrCounts(self, novel=None, notes=None):
|
||||||
"""Set the current word counts.
|
"""Set the worc count totals for novel and note files.
|
||||||
"""
|
"""
|
||||||
if value != self._currCount.get(type, 0):
|
if novel is not None:
|
||||||
self._currCount[type] = checkInt(value, 0)
|
self._currCounts[0] = checkInt(novel, 0)
|
||||||
self.theProject.setProjectChanged(True)
|
if notes is not None:
|
||||||
|
self._currCounts[1] = checkInt(notes, 0)
|
||||||
return
|
return
|
||||||
|
|
||||||
def setAutoReplace(self, value):
|
def setAutoReplace(self, value):
|
||||||
|
|||||||
@@ -266,12 +266,10 @@ class ProjectXMLReader:
|
|||||||
projData.setSpellCheck(xItem.text)
|
projData.setSpellCheck(xItem.text)
|
||||||
elif xItem.tag == "spellLang":
|
elif xItem.tag == "spellLang":
|
||||||
projData.setSpellLang(xItem.text)
|
projData.setSpellLang(xItem.text)
|
||||||
elif xItem.tag == "totalWordCount":
|
|
||||||
projData.setLastCount(xItem.text, "total")
|
|
||||||
elif xItem.tag == "novelWordCount":
|
elif xItem.tag == "novelWordCount":
|
||||||
projData.setLastCount(xItem.text, "novel")
|
projData.setInitCounts(novel=xItem.text)
|
||||||
elif xItem.tag == "notesWordCount":
|
elif xItem.tag == "notesWordCount":
|
||||||
projData.setLastCount(xItem.text, "notes")
|
projData.setInitCounts(notes=xItem.text)
|
||||||
elif xItem.tag == "status":
|
elif xItem.tag == "status":
|
||||||
self._parseStatusImport(xItem, projData.itemStatus)
|
self._parseStatusImport(xItem, projData.itemStatus)
|
||||||
elif xItem.tag in ("import", "importance"):
|
elif xItem.tag in ("import", "importance"):
|
||||||
@@ -289,18 +287,7 @@ class ProjectXMLReader:
|
|||||||
else: # Pre 1.4 format
|
else: # Pre 1.4 format
|
||||||
projData.setTitleFormat(self._parseDictTagText(xItem))
|
projData.setTitleFormat(self._parseDictTagText(xItem))
|
||||||
else:
|
else:
|
||||||
if self._version < 0x0104:
|
logger.warning("Ignored <root/settings/%s> in xml", xItem.tag)
|
||||||
# Convert some deprecated fields
|
|
||||||
if xItem.tag == "lastEdited": # Discontinued in 1.4
|
|
||||||
projData.setLastHandle(xItem.text, "editor")
|
|
||||||
elif xItem.tag == "lastViewed": # Discontinued in 1.4
|
|
||||||
projData.setLastHandle(xItem.text, "viewer")
|
|
||||||
elif xItem.tag == "lastWordCount": # Renamed in 1.4
|
|
||||||
projData.setLastCount(xItem.text, "total")
|
|
||||||
else:
|
|
||||||
logger.warning("Ignored <root/settings/%s> in xml", xItem.tag)
|
|
||||||
else:
|
|
||||||
logger.warning("Ignored <root/settings/%s> in xml", xItem.tag)
|
|
||||||
|
|
||||||
return True
|
return True
|
||||||
|
|
||||||
@@ -495,9 +482,8 @@ class ProjectXMLWriter:
|
|||||||
self._packSingleValue(xSettings, "language", projData.language)
|
self._packSingleValue(xSettings, "language", projData.language)
|
||||||
self._packSingleValue(xSettings, "spellCheck", projData.spellCheck)
|
self._packSingleValue(xSettings, "spellCheck", projData.spellCheck)
|
||||||
self._packSingleValue(xSettings, "spellLang", projData.spellLang)
|
self._packSingleValue(xSettings, "spellLang", projData.spellLang)
|
||||||
self._packSingleValue(xSettings, "totalWordCount", projData.getCurrCount("total"))
|
self._packSingleValue(xSettings, "novelWordCount", projData.currCounts[0])
|
||||||
self._packSingleValue(xSettings, "novelWordCount", projData.getCurrCount("novel"))
|
self._packSingleValue(xSettings, "notesWordCount", projData.currCounts[1])
|
||||||
self._packSingleValue(xSettings, "notesWordCount", projData.getCurrCount("notes"))
|
|
||||||
self._packDictKeyValue(xSettings, "lastHandle", projData.lastHandle)
|
self._packDictKeyValue(xSettings, "lastHandle", projData.lastHandle)
|
||||||
self._packDictKeyValue(xSettings, "autoReplace", projData.autoReplace)
|
self._packDictKeyValue(xSettings, "autoReplace", projData.autoReplace)
|
||||||
self._packDictKeyValue(xSettings, "titleFormat", projData.titleFormat)
|
self._packDictKeyValue(xSettings, "titleFormat", projData.titleFormat)
|
||||||
|
|||||||
@@ -1559,13 +1559,13 @@ class GuiMain(QMainWindow):
|
|||||||
|
|
||||||
self.theProject.updateWordCounts()
|
self.theProject.updateWordCounts()
|
||||||
if self.mainConf.incNotesWCount:
|
if self.mainConf.incNotesWCount:
|
||||||
currWords = self.theProject.data.getCurrCount("total")
|
iTotal = sum(self.theProject.data.initCounts)
|
||||||
diffWords = currWords - self.theProject.data.getLastCount("total")
|
cTotal = sum(self.theProject.data.currCounts)
|
||||||
|
self.mainStatus.setProjectStats(cTotal, cTotal - iTotal)
|
||||||
else:
|
else:
|
||||||
currWords = self.theProject.data.getCurrCount("novel")
|
iNovel, _ = self.theProject.data.initCounts
|
||||||
diffWords = currWords - self.theProject.data.getLastCount("novel")
|
cNovel, _ = self.theProject.data.currCounts
|
||||||
|
self.mainStatus.setProjectStats(cNovel, cNovel - iNovel)
|
||||||
self.mainStatus.setProjectStats(currWords, diffWords)
|
|
||||||
|
|
||||||
return
|
return
|
||||||
|
|
||||||
|
|||||||
@@ -1,20 +1,19 @@
|
|||||||
<?xml version='1.0' encoding='utf-8'?>
|
<?xml version='1.0' encoding='utf-8'?>
|
||||||
<novelWriterXML appVersion="2.0-rc1" hexVersion="0x020000c1" fileVersion="1.4" timeStamp="2022-10-31 22:33:20">
|
<novelWriterXML appVersion="2.0-rc1" hexVersion="0x020000c1" fileVersion="1.4" timeStamp="2022-11-01 12:20:53">
|
||||||
<project>
|
<project>
|
||||||
<name>Sample Project</name>
|
<name>Sample Project</name>
|
||||||
<title>Sample Project</title>
|
<title>Sample Project</title>
|
||||||
<author>Jane Smith</author>
|
<author>Jane Smith</author>
|
||||||
<author>Jay Doh</author>
|
<author>Jay Doh</author>
|
||||||
<saveCount>1407</saveCount>
|
<saveCount>1409</saveCount>
|
||||||
<autoCount>236</autoCount>
|
<autoCount>236</autoCount>
|
||||||
<editTime>69424</editTime>
|
<editTime>69427</editTime>
|
||||||
</project>
|
</project>
|
||||||
<settings>
|
<settings>
|
||||||
<doBackup>False</doBackup>
|
<doBackup>False</doBackup>
|
||||||
<language>en_GB</language>
|
<language>en_GB</language>
|
||||||
<spellCheck>True</spellCheck>
|
<spellCheck>True</spellCheck>
|
||||||
<spellLang>None</spellLang>
|
<spellLang>None</spellLang>
|
||||||
<totalWordCount>1363</totalWordCount>
|
|
||||||
<novelWordCount>954</novelWordCount>
|
<novelWordCount>954</novelWordCount>
|
||||||
<notesWordCount>409</notesWordCount>
|
<notesWordCount>409</notesWordCount>
|
||||||
<lastHandle>
|
<lastHandle>
|
||||||
|
|||||||
@@ -1,5 +1,5 @@
|
|||||||
<?xml version='1.0' encoding='utf-8'?>
|
<?xml version='1.0' encoding='utf-8'?>
|
||||||
<novelWriterXML appVersion="2.0-rc1" hexVersion="0x020000c1" fileVersion="1.4" timeStamp="2022-10-31 23:08:06">
|
<novelWriterXML appVersion="2.0-rc1" hexVersion="0x020000c1" fileVersion="1.4" timeStamp="2022-11-01 11:53:22">
|
||||||
<project>
|
<project>
|
||||||
<name>Test Custom</name>
|
<name>Test Custom</name>
|
||||||
<title>Test Novel</title>
|
<title>Test Novel</title>
|
||||||
@@ -14,7 +14,6 @@
|
|||||||
<language>None</language>
|
<language>None</language>
|
||||||
<spellCheck>False</spellCheck>
|
<spellCheck>False</spellCheck>
|
||||||
<spellLang>None</spellLang>
|
<spellLang>None</spellLang>
|
||||||
<totalWordCount>0</totalWordCount>
|
|
||||||
<novelWordCount>0</novelWordCount>
|
<novelWordCount>0</novelWordCount>
|
||||||
<notesWordCount>0</notesWordCount>
|
<notesWordCount>0</notesWordCount>
|
||||||
<lastHandle>
|
<lastHandle>
|
||||||
|
|||||||
@@ -1,5 +1,5 @@
|
|||||||
<?xml version='1.0' encoding='utf-8'?>
|
<?xml version='1.0' encoding='utf-8'?>
|
||||||
<novelWriterXML appVersion="2.0-rc1" hexVersion="0x020000c1" fileVersion="1.4" timeStamp="2022-10-31 23:08:06">
|
<novelWriterXML appVersion="2.0-rc1" hexVersion="0x020000c1" fileVersion="1.4" timeStamp="2022-11-01 11:53:22">
|
||||||
<project>
|
<project>
|
||||||
<name>Test Custom</name>
|
<name>Test Custom</name>
|
||||||
<title>Test Novel</title>
|
<title>Test Novel</title>
|
||||||
@@ -14,7 +14,6 @@
|
|||||||
<language>None</language>
|
<language>None</language>
|
||||||
<spellCheck>False</spellCheck>
|
<spellCheck>False</spellCheck>
|
||||||
<spellLang>None</spellLang>
|
<spellLang>None</spellLang>
|
||||||
<totalWordCount>0</totalWordCount>
|
|
||||||
<novelWordCount>0</novelWordCount>
|
<novelWordCount>0</novelWordCount>
|
||||||
<notesWordCount>0</notesWordCount>
|
<notesWordCount>0</notesWordCount>
|
||||||
<lastHandle>
|
<lastHandle>
|
||||||
|
|||||||
@@ -1,5 +1,5 @@
|
|||||||
<?xml version='1.0' encoding='utf-8'?>
|
<?xml version='1.0' encoding='utf-8'?>
|
||||||
<novelWriterXML appVersion="2.0-rc1" hexVersion="0x020000c1" fileVersion="1.4" timeStamp="2022-10-31 23:06:52">
|
<novelWriterXML appVersion="2.0-rc1" hexVersion="0x020000c1" fileVersion="1.4" timeStamp="2022-11-01 11:53:22">
|
||||||
<project>
|
<project>
|
||||||
<name>New Project</name>
|
<name>New Project</name>
|
||||||
<title>New Novel</title>
|
<title>New Novel</title>
|
||||||
@@ -13,7 +13,6 @@
|
|||||||
<language>None</language>
|
<language>None</language>
|
||||||
<spellCheck>False</spellCheck>
|
<spellCheck>False</spellCheck>
|
||||||
<spellLang>None</spellLang>
|
<spellLang>None</spellLang>
|
||||||
<totalWordCount>13</totalWordCount>
|
|
||||||
<novelWordCount>10</novelWordCount>
|
<novelWordCount>10</novelWordCount>
|
||||||
<notesWordCount>3</notesWordCount>
|
<notesWordCount>3</notesWordCount>
|
||||||
<lastHandle>
|
<lastHandle>
|
||||||
|
|||||||
@@ -1,5 +1,5 @@
|
|||||||
<?xml version='1.0' encoding='utf-8'?>
|
<?xml version='1.0' encoding='utf-8'?>
|
||||||
<novelWriterXML appVersion="2.0-rc1" hexVersion="0x020000c1" fileVersion="1.4" timeStamp="2022-10-31 23:08:06">
|
<novelWriterXML appVersion="2.0-rc1" hexVersion="0x020000c1" fileVersion="1.4" timeStamp="2022-11-01 11:53:22">
|
||||||
<project>
|
<project>
|
||||||
<name>New Project</name>
|
<name>New Project</name>
|
||||||
<title>None</title>
|
<title>None</title>
|
||||||
@@ -12,7 +12,6 @@
|
|||||||
<language>None</language>
|
<language>None</language>
|
||||||
<spellCheck>False</spellCheck>
|
<spellCheck>False</spellCheck>
|
||||||
<spellLang>None</spellLang>
|
<spellLang>None</spellLang>
|
||||||
<totalWordCount>0</totalWordCount>
|
|
||||||
<novelWordCount>0</novelWordCount>
|
<novelWordCount>0</novelWordCount>
|
||||||
<notesWordCount>0</notesWordCount>
|
<notesWordCount>0</notesWordCount>
|
||||||
<lastHandle>
|
<lastHandle>
|
||||||
|
|||||||
@@ -1,5 +1,5 @@
|
|||||||
<?xml version='1.0' encoding='utf-8'?>
|
<?xml version='1.0' encoding='utf-8'?>
|
||||||
<novelWriterXML appVersion="2.0-rc1" hexVersion="0x020000c1" fileVersion="1.4" timeStamp="2022-10-31 23:08:06">
|
<novelWriterXML appVersion="2.0-rc1" hexVersion="0x020000c1" fileVersion="1.4" timeStamp="2022-11-01 11:53:22">
|
||||||
<project>
|
<project>
|
||||||
<name>New Project</name>
|
<name>New Project</name>
|
||||||
<title>New Novel</title>
|
<title>New Novel</title>
|
||||||
@@ -13,7 +13,6 @@
|
|||||||
<language>None</language>
|
<language>None</language>
|
||||||
<spellCheck>False</spellCheck>
|
<spellCheck>False</spellCheck>
|
||||||
<spellLang>None</spellLang>
|
<spellLang>None</spellLang>
|
||||||
<totalWordCount>9</totalWordCount>
|
|
||||||
<novelWordCount>9</novelWordCount>
|
<novelWordCount>9</novelWordCount>
|
||||||
<notesWordCount>0</notesWordCount>
|
<notesWordCount>0</notesWordCount>
|
||||||
<lastHandle>
|
<lastHandle>
|
||||||
|
|||||||
@@ -1,19 +1,18 @@
|
|||||||
<?xml version='1.0' encoding='utf-8'?>
|
<?xml version='1.0' encoding='utf-8'?>
|
||||||
<novelWriterXML appVersion="2.0-rc1" hexVersion="0x020000c1" fileVersion="1.4" timeStamp="2022-10-31 22:53:34">
|
<novelWriterXML appVersion="2.0-rc1" hexVersion="0x020000c1" fileVersion="1.4" timeStamp="2022-11-01 12:01:37">
|
||||||
<project>
|
<project>
|
||||||
<name>New Project</name>
|
<name>New Project</name>
|
||||||
<title>New Novel</title>
|
<title>New Novel</title>
|
||||||
<author>Jane Doe</author>
|
<author>Jane Doe</author>
|
||||||
<saveCount>4</saveCount>
|
<saveCount>4</saveCount>
|
||||||
<autoCount>2</autoCount>
|
<autoCount>2</autoCount>
|
||||||
<editTime>4</editTime>
|
<editTime>3</editTime>
|
||||||
</project>
|
</project>
|
||||||
<settings>
|
<settings>
|
||||||
<doBackup>True</doBackup>
|
<doBackup>True</doBackup>
|
||||||
<language>None</language>
|
<language>None</language>
|
||||||
<spellCheck>True</spellCheck>
|
<spellCheck>True</spellCheck>
|
||||||
<spellLang>None</spellLang>
|
<spellLang>None</spellLang>
|
||||||
<totalWordCount>163</totalWordCount>
|
|
||||||
<novelWordCount>136</novelWordCount>
|
<novelWordCount>136</novelWordCount>
|
||||||
<notesWordCount>27</notesWordCount>
|
<notesWordCount>27</notesWordCount>
|
||||||
<lastHandle>
|
<lastHandle>
|
||||||
|
|||||||
@@ -1,5 +1,5 @@
|
|||||||
<?xml version='1.0' encoding='utf-8'?>
|
<?xml version='1.0' encoding='utf-8'?>
|
||||||
<novelWriterXML appVersion="2.0-rc1" hexVersion="0x020000c1" fileVersion="1.4" timeStamp="2022-10-31 22:20:53">
|
<novelWriterXML appVersion="2.0-rc1" hexVersion="0x020000c1" fileVersion="1.4" timeStamp="2022-11-01 11:53:30">
|
||||||
<project>
|
<project>
|
||||||
<name>New Project</name>
|
<name>New Project</name>
|
||||||
<title>New Novel</title>
|
<title>New Novel</title>
|
||||||
@@ -13,7 +13,6 @@
|
|||||||
<language>None</language>
|
<language>None</language>
|
||||||
<spellCheck>False</spellCheck>
|
<spellCheck>False</spellCheck>
|
||||||
<spellLang>None</spellLang>
|
<spellLang>None</spellLang>
|
||||||
<totalWordCount>9</totalWordCount>
|
|
||||||
<novelWordCount>9</novelWordCount>
|
<novelWordCount>9</novelWordCount>
|
||||||
<notesWordCount>0</notesWordCount>
|
<notesWordCount>0</notesWordCount>
|
||||||
<lastHandle>
|
<lastHandle>
|
||||||
|
|||||||
@@ -1003,8 +1003,8 @@ def testCoreProject_Methods(monkeypatch, mockGUI, tmpDir, fncDir, mockRnd):
|
|||||||
assert theProject.tree.handles() == oldOrder
|
assert theProject.tree.handles() == oldOrder
|
||||||
|
|
||||||
# Session stats
|
# Session stats
|
||||||
theProject.data.setCurrCount(200, "total")
|
theProject._data._initCounts = [50, 50]
|
||||||
theProject.data.setLastCount(100, "total")
|
theProject._data._currCounts = [100, 100]
|
||||||
with monkeypatch.context() as mp:
|
with monkeypatch.context() as mp:
|
||||||
mp.setattr("os.path.isdir", lambda *a, **k: False)
|
mp.setattr("os.path.isdir", lambda *a, **k: False)
|
||||||
assert not theProject._appendSessionStats(idleTime=0)
|
assert not theProject._appendSessionStats(idleTime=0)
|
||||||
@@ -1019,8 +1019,7 @@ def testCoreProject_Methods(monkeypatch, mockGUI, tmpDir, fncDir, mockRnd):
|
|||||||
statsFile = os.path.join(theProject.projMeta, nwFiles.SESS_STATS)
|
statsFile = os.path.join(theProject.projMeta, nwFiles.SESS_STATS)
|
||||||
|
|
||||||
theProject._projOpened = 1600002000
|
theProject._projOpened = 1600002000
|
||||||
theProject._data.setCurrCount(200, "novel")
|
theProject._data._currCounts = [200, 100]
|
||||||
theProject._data.setCurrCount(100, "notes")
|
|
||||||
|
|
||||||
with monkeypatch.context() as mp:
|
with monkeypatch.context() as mp:
|
||||||
mp.setattr("novelwriter.core.project.time", lambda: 1600005600)
|
mp.setattr("novelwriter.core.project.time", lambda: 1600005600)
|
||||||
|
|||||||
Reference in New Issue
Block a user