Corrected default title formats, and added editTime meta data

This commit is contained in:
Veronica K. B. Olsen
2020-05-29 23:46:13 +02:00
parent 5d2f6d33b5
commit 7b8a852101
9 changed files with 14 additions and 10 deletions
+6 -2
View File
@@ -69,6 +69,7 @@ class NWProject():
self.lockedBy = None # Data on which computer has the project open self.lockedBy = None # Data on which computer has the project open
self.saveCount = 0 # Meta data: number of saves self.saveCount = 0 # Meta data: number of saves
self.autoCount = 0 # Meta data: number of automatic saves self.autoCount = 0 # Meta data: number of automatic saves
self.editTime = 0 # The accumulated edit time read from the project file
# Class Settings # Class Settings
self.projPath = None # The full path to where the currently open project is saved self.projPath = None # The full path to where the currently open project is saved
@@ -206,7 +207,7 @@ class NWProject():
self.autoReplace = {} self.autoReplace = {}
self.titleFormat = { self.titleFormat = {
"title" : r"%title%", "title" : r"%title%",
"chapter" : r"Chapter %num%\\%title%", "chapter" : r"Chapter %ch%: %title%",
"unnumbered" : r"%title%", "unnumbered" : r"%title%",
"scene" : r"* * *", "scene" : r"* * *",
"section" : r"", "section" : r"",
@@ -330,6 +331,8 @@ class NWProject():
self.saveCount = checkInt(xRoot.attrib["saveCount"], 0, False) self.saveCount = checkInt(xRoot.attrib["saveCount"], 0, False)
if "autoCount" in xRoot.attrib: if "autoCount" in xRoot.attrib:
self.autoCount = checkInt(xRoot.attrib["autoCount"], 0, False) self.autoCount = checkInt(xRoot.attrib["autoCount"], 0, False)
if "editTime" in xRoot.attrib:
self.editTime = checkInt(xRoot.attrib["editTime"], 0, False)
logger.verbose("XML root is %s" % nwxRoot) logger.verbose("XML root is %s" % nwxRoot)
logger.verbose("File version is %s" % fileVersion) logger.verbose("File version is %s" % fileVersion)
@@ -486,6 +489,7 @@ class NWProject():
"saveCount" : str(self.saveCount), "saveCount" : str(self.saveCount),
"autoCount" : str(self.autoCount), "autoCount" : str(self.autoCount),
"timeStamp" : formatTimeStamp(saveTime), "timeStamp" : formatTimeStamp(saveTime),
"editTime" : str(int(self.editTime + saveTime - self.projOpened)),
}) })
# Save Project Meta # Save Project Meta
@@ -535,7 +539,7 @@ class NWProject():
xml_declaration = True xml_declaration = True
)) ))
except Exception as e: except Exception as e:
self.makeAlert(["Failed to save project.",str(e)], nwAlert.ERROR) self.makeAlert(["Failed to save project.", str(e)], nwAlert.ERROR)
return False return False
# If we're here, the file was successfully saved, # If we're here, the file was successfully saved,
+1 -1
View File
@@ -1,5 +1,5 @@
<?xml version='1.0' encoding='utf-8'?> <?xml version='1.0' encoding='utf-8'?>
<novelWriterXML appVersion="0.7.0rc1" hexVersion="0x000700c1" fileVersion="1.1" saveCount="197" autoCount="29" timeStamp="2020-05-29 23:27:14"> <novelWriterXML appVersion="0.7.0rc1" hexVersion="0x000700c1" fileVersion="1.1" saveCount="200" autoCount="29" timeStamp="2020-05-29 23:45:11" editTime="30">
<project> <project>
<name>Sample Project</name> <name>Sample Project</name>
<title>Sample Project</title> <title>Sample Project</title>
+1 -1
View File
@@ -14,7 +14,7 @@
<autoReplace/> <autoReplace/>
<titleFormat> <titleFormat>
<title>%title%</title> <title>%title%</title>
<chapter>Chapter %num%\\%title%</chapter> <chapter>Chapter %ch%: %title%</chapter>
<unnumbered>%title%</unnumbered> <unnumbered>%title%</unnumbered>
<scene>* * *</scene> <scene>* * *</scene>
<section></section> <section></section>
+1 -1
View File
@@ -14,7 +14,7 @@
<autoReplace/> <autoReplace/>
<titleFormat> <titleFormat>
<title>%title%</title> <title>%title%</title>
<chapter>Chapter %num%\\%title%</chapter> <chapter>Chapter %ch%: %title%</chapter>
<unnumbered>%title%</unnumbered> <unnumbered>%title%</unnumbered>
<scene>* * *</scene> <scene>* * *</scene>
<section></section> <section></section>
+1 -1
View File
@@ -18,7 +18,7 @@
</autoReplace> </autoReplace>
<titleFormat> <titleFormat>
<title>%title%</title> <title>%title%</title>
<chapter>Chapter %num%\\%title%</chapter> <chapter>Chapter %ch%: %title%</chapter>
<unnumbered>%title%</unnumbered> <unnumbered>%title%</unnumbered>
<scene>* * *</scene> <scene>* * *</scene>
<section></section> <section></section>
+1 -1
View File
@@ -14,7 +14,7 @@
<autoReplace/> <autoReplace/>
<titleFormat> <titleFormat>
<title>%title%</title> <title>%title%</title>
<chapter>Chapter %num%\\%title%</chapter> <chapter>Chapter %ch%: %title%</chapter>
<unnumbered>%title%</unnumbered> <unnumbered>%title%</unnumbered>
<scene>* * *</scene> <scene>* * *</scene>
<section></section> <section></section>
+1 -1
View File
@@ -14,7 +14,7 @@
<autoReplace/> <autoReplace/>
<titleFormat> <titleFormat>
<title>%title%</title> <title>%title%</title>
<chapter>Chapter %num%\\%title%</chapter> <chapter>Chapter %ch%: %title%</chapter>
<unnumbered>%title%</unnumbered> <unnumbered>%title%</unnumbered>
<scene>* * *</scene> <scene>* * *</scene>
<section></section> <section></section>
+1 -1
View File
@@ -14,7 +14,7 @@
<autoReplace/> <autoReplace/>
<titleFormat> <titleFormat>
<title>%title%</title> <title>%title%</title>
<chapter>Chapter %num%\\%title%</chapter> <chapter>Chapter %ch%: %title%</chapter>
<unnumbered>%title%</unnumbered> <unnumbered>%title%</unnumbered>
<scene>* * *</scene> <scene>* * *</scene>
<section></section> <section></section>
+1 -1
View File
@@ -14,7 +14,7 @@
<autoReplace/> <autoReplace/>
<titleFormat> <titleFormat>
<title>%title%</title> <title>%title%</title>
<chapter>Chapter %num%\\%title%</chapter> <chapter>Chapter %ch%: %title%</chapter>
<unnumbered>%title%</unnumbered> <unnumbered>%title%</unnumbered>
<scene>* * *</scene> <scene>* * *</scene>
<section></section> <section></section>