Added a log file that appends session stats.
This commit is contained in:
@@ -17,6 +17,7 @@ class nwFiles():
|
|||||||
APP_ICON = "novelWriter.svg"
|
APP_ICON = "novelWriter.svg"
|
||||||
PROJ_FILE = "nwProject.nwx"
|
PROJ_FILE = "nwProject.nwx"
|
||||||
PROJ_DICT = "wordlist.txt"
|
PROJ_DICT = "wordlist.txt"
|
||||||
|
SESS_INFO = "sessionInfo.log"
|
||||||
|
|
||||||
# END Class nwFiles
|
# END Class nwFiles
|
||||||
|
|
||||||
|
|||||||
+2
-1
@@ -237,7 +237,7 @@ class GuiMain(QMainWindow):
|
|||||||
saveOK = True
|
saveOK = True
|
||||||
|
|
||||||
if saveOK:
|
if saveOK:
|
||||||
self.theProject.clearProject()
|
self.theProject.closeProject()
|
||||||
self.clearGUI()
|
self.clearGUI()
|
||||||
self.hasProject = False
|
self.hasProject = False
|
||||||
|
|
||||||
@@ -451,6 +451,7 @@ class GuiMain(QMainWindow):
|
|||||||
self.saveDocument()
|
self.saveDocument()
|
||||||
if self._takeProjectAction():
|
if self._takeProjectAction():
|
||||||
self.saveProject()
|
self.saveProject()
|
||||||
|
self.theProject.closeProject()
|
||||||
self.mainConf.setWinSize(self.width(), self.height())
|
self.mainConf.setWinSize(self.width(), self.height())
|
||||||
self.mainConf.setTreeColWidths(self.treeView.getColumnSizes())
|
self.mainConf.setTreeColWidths(self.treeView.getColumnSizes())
|
||||||
self.mainConf.setMainPanePos(self.splitMain.sizes())
|
self.mainConf.setMainPanePos(self.splitMain.sizes())
|
||||||
|
|||||||
@@ -35,6 +35,7 @@ class NWProject():
|
|||||||
self.theParent = theParent
|
self.theParent = theParent
|
||||||
self.mainConf = self.theParent.mainConf
|
self.mainConf = self.theParent.mainConf
|
||||||
self.projChanged = None
|
self.projChanged = None
|
||||||
|
self.projOpened = None
|
||||||
|
|
||||||
# Debug
|
# Debug
|
||||||
self.handleSeed = None
|
self.handleSeed = None
|
||||||
@@ -135,6 +136,7 @@ class NWProject():
|
|||||||
def clearProject(self):
|
def clearProject(self):
|
||||||
|
|
||||||
self.projChanged = None
|
self.projChanged = None
|
||||||
|
self.projOpened = None
|
||||||
|
|
||||||
# Project Settings
|
# Project Settings
|
||||||
self.projTree = {}
|
self.projTree = {}
|
||||||
@@ -251,6 +253,7 @@ class NWProject():
|
|||||||
|
|
||||||
self._scanProjectFolder()
|
self._scanProjectFolder()
|
||||||
self.setProjectChanged(False)
|
self.setProjectChanged(False)
|
||||||
|
self.projOpened = time()
|
||||||
|
|
||||||
return True
|
return True
|
||||||
|
|
||||||
@@ -321,6 +324,11 @@ class NWProject():
|
|||||||
|
|
||||||
return True
|
return True
|
||||||
|
|
||||||
|
def closeProject(self):
|
||||||
|
self._appendSessionStats()
|
||||||
|
self.clearProject()
|
||||||
|
return True
|
||||||
|
|
||||||
##
|
##
|
||||||
# Set Functions
|
# Set Functions
|
||||||
##
|
##
|
||||||
@@ -594,6 +602,24 @@ class NWProject():
|
|||||||
|
|
||||||
return
|
return
|
||||||
|
|
||||||
|
def _appendSessionStats(self):
|
||||||
|
|
||||||
|
if self.projMeta is None:
|
||||||
|
return False
|
||||||
|
|
||||||
|
with open(path.join(self.projMeta, nwFiles.SESS_INFO), mode="a+") as outFile:
|
||||||
|
print((
|
||||||
|
"Start: {opened:s} "
|
||||||
|
"End: {closed:s} "
|
||||||
|
"Words: {words:8d}"
|
||||||
|
).format(
|
||||||
|
opened = datetime.fromtimestamp(self.projOpened).strftime("%Y-%m-%d %H:%M:%S"),
|
||||||
|
closed = datetime.now().strftime("%Y-%m-%d %H:%M:%S"),
|
||||||
|
words = self.getSessionWordCount(),
|
||||||
|
), file=outFile)
|
||||||
|
|
||||||
|
return True
|
||||||
|
|
||||||
def _makeHandle(self, addSeed=""):
|
def _makeHandle(self, addSeed=""):
|
||||||
if self.handleSeed is None:
|
if self.handleSeed is None:
|
||||||
newSeed = str(time()) + addSeed
|
newSeed = str(time()) + addSeed
|
||||||
|
|||||||
@@ -13,8 +13,12 @@ Some text here would look good as well, and maybe some "dialogue"?
|
|||||||
|
|
||||||
So, this is some __text__ that we’ve been adding to this document. It is utterly meaningless text, _but_ since this is just dummy text, that doesn’t really matter. The text is perfectly happy to live in this document regardless.
|
So, this is some __text__ that we’ve been adding to this document. It is utterly meaningless text, _but_ since this is just dummy text, that doesn’t really matter. The text is perfectly happy to live in this document regardless.
|
||||||
|
|
||||||
This paragraph is also meaningless. At least a bit. It’s also very short.
|
This paragraph is also meaningless. At least a bit. It’s also very short. But we could make it less meaningless if we wanted to …
|
||||||
|
|
||||||
This one is a bit longer. “It also has some dialogue in it” she said, before she moved on to check if the spellchecker worked. It did. “Cool,” she concluded.
|
This one is a bit longer. “It also has some dialogue in it” she said, before she moved on to check if the spellchecker worked. It did. “Cool,” she concluded.
|
||||||
|
|
||||||
|
|
||||||
|
@ToDo: Stuff that will be done at some point
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
@@ -0,0 +1,3 @@
|
|||||||
|
Start: 2019-05-26 14:28:28 End: 2019-05-26 14:28:38 Words: -23
|
||||||
|
Start: 2019-05-26 14:31:12 End: 2019-05-26 14:31:34 Words: 12
|
||||||
|
Start: 2019-05-26 14:33:27 End: 2019-05-26 14:33:31 Words: 0
|
||||||
@@ -1,5 +1,5 @@
|
|||||||
<?xml version='1.0' encoding='utf-8'?>
|
<?xml version='1.0' encoding='utf-8'?>
|
||||||
<novelWriterXML appVersion="0.1.4" fileVersion="1.0" timeStamp="2019-05-25 23:24:06">
|
<novelWriterXML appVersion="0.1.4" fileVersion="1.0" timeStamp="2019-05-26 14:33:31">
|
||||||
<project>
|
<project>
|
||||||
<name>Sample Project</name>
|
<name>Sample Project</name>
|
||||||
<title>Sample Project</title>
|
<title>Sample Project</title>
|
||||||
@@ -10,7 +10,7 @@
|
|||||||
<spellCheck>True</spellCheck>
|
<spellCheck>True</spellCheck>
|
||||||
<lastEdited>636b6aa9b697b</lastEdited>
|
<lastEdited>636b6aa9b697b</lastEdited>
|
||||||
<lastViewed>None</lastViewed>
|
<lastViewed>None</lastViewed>
|
||||||
<lastWordCount>523</lastWordCount>
|
<lastWordCount>535</lastWordCount>
|
||||||
<status>
|
<status>
|
||||||
<entry blue="100" green="100" red="100">New</entry>
|
<entry blue="100" green="100" red="100">New</entry>
|
||||||
<entry blue="0" green="50" red="200">Notes</entry>
|
<entry blue="0" green="50" red="200">Notes</entry>
|
||||||
@@ -73,10 +73,10 @@
|
|||||||
<status>Notes</status>
|
<status>Notes</status>
|
||||||
<expanded>False</expanded>
|
<expanded>False</expanded>
|
||||||
<layout>SCENE</layout>
|
<layout>SCENE</layout>
|
||||||
<charCount>577</charCount>
|
<charCount>633</charCount>
|
||||||
<wordCount>104</wordCount>
|
<wordCount>116</wordCount>
|
||||||
<paraCount>5</paraCount>
|
<paraCount>5</paraCount>
|
||||||
<cursorPos>655</cursorPos>
|
<cursorPos>551</cursorPos>
|
||||||
</item>
|
</item>
|
||||||
<item handle="bc0cbd2a407f3" order="2" parent="e7ded148d6e4a">
|
<item handle="bc0cbd2a407f3" order="2" parent="e7ded148d6e4a">
|
||||||
<name>New File</name>
|
<name>New File</name>
|
||||||
|
|||||||
Reference in New Issue
Block a user