The Writing Stats tool should not pop an error message if there is no satistics log
This commit is contained in:
@@ -403,8 +403,12 @@ class GuiWritingStats(QDialog):
|
|||||||
ttNotes = 0
|
ttNotes = 0
|
||||||
ttTime = 0
|
ttTime = 0
|
||||||
|
|
||||||
|
logFile = os.path.join(self.theProject.projMeta, nwFiles.SESS_STATS)
|
||||||
|
if not os.path.isfile(logFile):
|
||||||
|
logger.info("This project has no writing stats logfile")
|
||||||
|
return False
|
||||||
|
|
||||||
try:
|
try:
|
||||||
logFile = os.path.join(self.theProject.projMeta, nwFiles.SESS_STATS)
|
|
||||||
with open(logFile, mode="r", encoding="utf8") as inFile:
|
with open(logFile, mode="r", encoding="utf8") as inFile:
|
||||||
for inLine in inFile:
|
for inLine in inFile:
|
||||||
if inLine.startswith("#"):
|
if inLine.startswith("#"):
|
||||||
|
|||||||
@@ -203,6 +203,7 @@ def testGuiWritingStats_Dialog(qtbot, monkeypatch, nwGUI, fncDir, fncProj):
|
|||||||
# IOError
|
# IOError
|
||||||
# =======
|
# =======
|
||||||
monkeypatch.setattr("builtins.open", causeOSError)
|
monkeypatch.setattr("builtins.open", causeOSError)
|
||||||
|
assert not sessLog._loadLogFile()
|
||||||
assert not sessLog._saveData(sessLog.FMT_CSV)
|
assert not sessLog._saveData(sessLog.FMT_CSV)
|
||||||
|
|
||||||
# qtbot.stopForInteraction()
|
# qtbot.stopForInteraction()
|
||||||
|
|||||||
Reference in New Issue
Block a user