Fix minor mistakes in source files from last commits
This commit is contained in:
@@ -89,7 +89,6 @@ class nwFiles:
|
||||
BUILDS_FILE = "builds.json"
|
||||
INDEX_FILE = "index.json"
|
||||
OPTS_FILE = "options.json"
|
||||
PROJ_DICT = "wordlist.txt"
|
||||
DICT_FILE = "userdict.json"
|
||||
SESS_FILE = "sessions.jsonl"
|
||||
|
||||
|
||||
@@ -517,7 +517,7 @@ class NWIndex:
|
||||
"""Count the number of words in the novel project."""
|
||||
wCount = 0
|
||||
for _, _, hItem in self._itemIndex.iterNovelStructure(skipExcl=skipExcl):
|
||||
wCount += hItem.wordCount if isinstance(hItem, IndexHeading) else 0
|
||||
wCount += hItem.wordCount
|
||||
return wCount
|
||||
|
||||
def getNovelTitleCounts(self, skipExcl: bool = True) -> list[int]:
|
||||
|
||||
@@ -34,7 +34,6 @@ from functools import partial
|
||||
from PyQt5.QtCore import QCoreApplication, QObject, pyqtSignal
|
||||
|
||||
from novelwriter import CONFIG, __version__, __hexversion__
|
||||
from novelwriter.core.sessions import NWSessionLog
|
||||
from novelwriter.enum import nwItemType, nwItemClass, nwItemLayout, nwAlert
|
||||
from novelwriter.error import logException
|
||||
from novelwriter.constants import trConst, nwLabels
|
||||
@@ -43,6 +42,7 @@ from novelwriter.core.item import NWItem
|
||||
from novelwriter.core.index import NWIndex
|
||||
from novelwriter.core.options import OptionState
|
||||
from novelwriter.core.storage import NWStorage
|
||||
from novelwriter.core.sessions import NWSessionLog
|
||||
from novelwriter.core.projectxml import ProjectXMLReader, ProjectXMLWriter, XMLReadState
|
||||
from novelwriter.core.projectdata import NWProjectData
|
||||
from novelwriter.common import (
|
||||
|
||||
@@ -34,7 +34,7 @@ from novelwriter.error import logException
|
||||
from novelwriter.common import formatTimeStamp
|
||||
from novelwriter.constants import nwFiles
|
||||
|
||||
if TYPE_CHECKING:
|
||||
if TYPE_CHECKING: # pragma: no cover
|
||||
from novelwriter.core.project import NWProject
|
||||
|
||||
logger = logging.getLogger(__name__)
|
||||
@@ -112,15 +112,14 @@ class NWSessionLog:
|
||||
def iterRecords(self) -> Iterator[dict]:
|
||||
"""Iterate through all records in the log."""
|
||||
sessFile = self._project.storage.getMetaFile(nwFiles.SESS_FILE)
|
||||
if not isinstance(sessFile, Path):
|
||||
return
|
||||
try:
|
||||
with open(sessFile, mode="r", encoding="utf-8") as fObj:
|
||||
for line in fObj:
|
||||
yield json.loads(line)
|
||||
except Exception:
|
||||
logger.error("Failed to process session stats file")
|
||||
logException()
|
||||
if isinstance(sessFile, Path):
|
||||
try:
|
||||
with open(sessFile, mode="r", encoding="utf-8") as fObj:
|
||||
for line in fObj:
|
||||
yield json.loads(line)
|
||||
except Exception:
|
||||
logger.error("Failed to process session stats file")
|
||||
logException()
|
||||
return
|
||||
|
||||
def createInitial(self, total: int) -> str:
|
||||
|
||||
@@ -45,9 +45,9 @@ from novelwriter import CONFIG
|
||||
from novelwriter.enum import (
|
||||
nwDocMode, nwItemClass, nwItemLayout, nwItemType, nwOutline
|
||||
)
|
||||
from novelwriter.error import logException
|
||||
from novelwriter.common import checkInt
|
||||
from novelwriter.constants import nwHeaders, trConst, nwKeyWords, nwLabels
|
||||
from novelwriter.error import logException
|
||||
from novelwriter.gui.components import NovelSelector
|
||||
|
||||
|
||||
|
||||
Reference in New Issue
Block a user