No need to set the session log offset value if it's 0
This commit is contained in:
+4
-2
@@ -1121,8 +1121,10 @@ class NWProject():
|
||||
with open(sessionFile, mode="a+", encoding="utf8") as outFile:
|
||||
if not isFile:
|
||||
# It's a new file, so add a header
|
||||
outFile.write("# Initial: %d\n# %-17s %-19s %8s %8s\n" % (
|
||||
self.lastWCount, "Start Time", "End Time", "Novel", "Notes"
|
||||
if self.lastWCount > 0:
|
||||
outFile.write("# Offset %d\n" % self.lastWCount)
|
||||
outFile.write("# %-17s %-19s %8s %8s\n" % (
|
||||
"Start Time", "End Time", "Novel", "Notes"
|
||||
))
|
||||
|
||||
outFile.write("%-19s %-19s %8d %8d\n" % (
|
||||
|
||||
@@ -401,8 +401,8 @@ class GuiSessionLog(QDialog):
|
||||
with open(logFile, mode="r", encoding="utf8") as inFile:
|
||||
for inLine in inFile:
|
||||
if inLine.startswith("#"):
|
||||
if inLine.startswith("# Initial:"):
|
||||
self.wordOffset = int(inLine[11:].strip())
|
||||
if inLine.startswith("# Offset"):
|
||||
self.wordOffset = int(inLine[9:].strip())
|
||||
logger.verbose(
|
||||
"Initial word count when log was started is %d" % self.wordOffset
|
||||
)
|
||||
|
||||
@@ -1,13 +1,13 @@
|
||||
<?xml version='1.0' encoding='utf-8'?>
|
||||
<novelWriterXML appVersion="0.10.0rc1" hexVersion="0x001000c1" fileVersion="1.1" timeStamp="2020-06-26 18:21:55">
|
||||
<novelWriterXML appVersion="0.10.0rc1" hexVersion="0x001000c1" fileVersion="1.1" timeStamp="2020-06-26 18:36:47">
|
||||
<project>
|
||||
<name>Sample Project</name>
|
||||
<title>Sample Project</title>
|
||||
<author>Jane Smith</author>
|
||||
<author>Jay Doh</author>
|
||||
<saveCount>583</saveCount>
|
||||
<saveCount>587</saveCount>
|
||||
<autoCount>102</autoCount>
|
||||
<editTime>24189</editTime>
|
||||
<editTime>24235</editTime>
|
||||
</project>
|
||||
<settings>
|
||||
<doBackup>False</doBackup>
|
||||
|
||||
Reference in New Issue
Block a user