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