Some completeness in logger output

This commit is contained in:
Veronica K. B. Olsen
2020-06-10 17:19:52 +02:00
parent b88fc2f1ca
commit 29950e34a4
10 changed files with 25 additions and 12 deletions
+3 -1
View File
@@ -216,7 +216,9 @@ def main(sysArgs=None):
logger.addHandler(cHandle) logger.addHandler(cHandle)
logger.setLevel(debugLevel) logger.setLevel(debugLevel)
logger.info("This is %s %s" % (__package__, __version__)) logger.info("Starting %s" % __package__)
logger.info("Version: %s (%s)" % (__version__, __hexversion__))
logger.info("Last Release: %s" % __date__)
# Check Packages and Versions # Check Packages and Versions
errorData = [] errorData = []
+3
View File
@@ -222,6 +222,7 @@ class Config:
"""Initialise the config class. The manual setting of confPath """Initialise the config class. The manual setting of confPath
and dataPath is mainly intended for the test suite. and dataPath is mainly intended for the test suite.
""" """
logger.debug("Initialising Config ...")
if confPath is None: if confPath is None:
confRoot = QStandardPaths.writableLocation(QStandardPaths.ConfigLocation) confRoot = QStandardPaths.writableLocation(QStandardPaths.ConfigLocation)
self.confPath = path.join(path.abspath(confRoot), self.appHandle) self.confPath = path.join(path.abspath(confRoot), self.appHandle)
@@ -304,6 +305,8 @@ class Config:
if self.spellLanguage is None: if self.spellLanguage is None:
self.spellLanguage = "en" self.spellLanguage = "en"
logger.debug("Config initialisation complete")
return True return True
def loadConfig(self): def loadConfig(self):
+1
View File
@@ -1041,6 +1041,7 @@ class NWProject():
return return
# Then check the files in the data folder # Then check the files in the data folder
logger.debug("Checking files in project content folder")
orphanFiles = [] orphanFiles = []
for fileItem in listdir(self.projContent): for fileItem in listdir(self.projContent):
if not fileItem.endswith(".nwd"): if not fileItem.endswith(".nwd"):
+2 -2
View File
@@ -115,12 +115,12 @@ class NWSpellCheck():
if not path.isfile(projectDict): if not path.isfile(projectDict):
return return
try: try:
with open(projectDict,mode="r",encoding="utf-8") as wordsFile: logger.debug("Loading project word list")
with open(projectDict, mode="r", encoding="utf-8") as wordsFile:
for theLine in wordsFile: for theLine in wordsFile:
theLine = theLine.strip() theLine = theLine.strip()
if len(theLine) > 0 and theLine not in self.PROJW: if len(theLine) > 0 and theLine not in self.PROJW:
self.PROJW.append(theLine) self.PROJW.append(theLine)
logger.debug("Project word list")
logger.debug("Project word list contains %d words" % len(self.PROJW)) logger.debug("Project word list contains %d words" % len(self.PROJW))
except Exception as e: except Exception as e:
logger.error("Failed to load project word list") logger.error("Failed to load project word list")
+2 -2
View File
@@ -477,7 +477,7 @@ class GuiDocViewDetails(QScrollArea):
def __init__(self, theParent): def __init__(self, theParent):
QScrollArea.__init__(self, theParent) QScrollArea.__init__(self, theParent)
logger.debug("Initialising DocViewDetails ...") logger.debug("Initialising GuiDocViewDetails ...")
self.mainConf = nw.CONFIG self.mainConf = nw.CONFIG
self.theParent = theParent self.theParent = theParent
self.theProject = theParent.theProject self.theProject = theParent.theProject
@@ -508,7 +508,7 @@ class GuiDocViewDetails(QScrollArea):
self.setWidgetResizable(True) self.setWidgetResizable(True)
self.setMinimumHeight(self.mainConf.pxInt(50)) self.setMinimumHeight(self.mainConf.pxInt(50))
logger.debug("DocViewDetails initialisation complete") logger.debug("GuiDocViewDetails initialisation complete")
return return
+2 -2
View File
@@ -42,7 +42,7 @@ class GuiDocHighlighter(QSyntaxHighlighter):
def __init__(self, theDoc, theParent): def __init__(self, theDoc, theParent):
QSyntaxHighlighter.__init__(self, theDoc) QSyntaxHighlighter.__init__(self, theDoc)
logger.debug("Initialising DocHighlighter ...") logger.debug("Initialising GuiDocHighlighter ...")
self.mainConf = nw.CONFIG self.mainConf = nw.CONFIG
self.theDoc = theDoc self.theDoc = theDoc
self.theParent = theParent self.theParent = theParent
@@ -70,7 +70,7 @@ class GuiDocHighlighter(QSyntaxHighlighter):
self.initHighlighter() self.initHighlighter()
logger.debug("DocHighlighter initialisation complete") logger.debug("GuiDocHighlighter initialisation complete")
return return
+4
View File
@@ -525,9 +525,13 @@ class GuiProjectTree(QTreeWidget):
always make sure items with a parent have had their parent item always make sure items with a parent have had their parent item
sent first. sent first.
""" """
logger.debug("Building project tree ...")
self.clear() self.clear()
iCount = 0
for nwItem in self.theProject.getProjectItems(): for nwItem in self.theProject.getProjectItems():
iCount += 1
self._addTreeItem(nwItem) self._addTreeItem(nwItem)
logger.debug("%d items added to project tree" % iCount)
return True return True
def getSelectedHandle(self): def getSelectedHandle(self):
+2 -2
View File
@@ -44,7 +44,7 @@ class GuiMainStatus(QStatusBar):
def __init__(self, theParent): def __init__(self, theParent):
QStatusBar.__init__(self, theParent) QStatusBar.__init__(self, theParent)
logger.debug("Initialising MainStatus ...") logger.debug("Initialising GuiMainStatus ...")
self.mainConf = nw.CONFIG self.mainConf = nw.CONFIG
self.theParent = theParent self.theParent = theParent
@@ -123,7 +123,7 @@ class GuiMainStatus(QStatusBar):
self.sessionTimer.timeout.connect(self._updateTime) self.sessionTimer.timeout.connect(self._updateTime)
self.sessionTimer.start() self.sessionTimer.start()
logger.debug("MainStatus initialisation complete") logger.debug("GuiMainStatus initialisation complete")
self.clearStatus() self.clearStatus()
+2 -2
View File
@@ -750,11 +750,11 @@ class GuiIcons:
self.mainConf.iconPath, self.fbackName, "%s-dark.svg" % iconKey self.mainConf.iconPath, self.fbackName, "%s-dark.svg" % iconKey
) )
if path.isfile(fbackIcon): if path.isfile(fbackIcon):
logger.verbose("Loading icon '%s' from fallback theme" % iconKey) logger.verbose("Loading icon '%s' from fallback theme (dark mode)" % iconKey)
return QIcon(fbackIcon) return QIcon(fbackIcon)
fbackIcon = path.join(self.mainConf.iconPath, self.fbackName, "%s.svg" % iconKey) fbackIcon = path.join(self.mainConf.iconPath, self.fbackName, "%s.svg" % iconKey)
if path.isfile(fbackIcon): if path.isfile(fbackIcon):
logger.verbose("Loading icon '%s' from fallback theme" % iconKey) logger.verbose("Loading icon '%s' from fallback theme (light mode)" % iconKey)
return QIcon(fbackIcon) return QIcon(fbackIcon)
# Give up and return an empty icon # Give up and return an empty icon
+4 -1
View File
@@ -55,7 +55,6 @@ class GuiMain(QMainWindow):
def __init__(self): def __init__(self):
QMainWindow.__init__(self) QMainWindow.__init__(self)
logger.info("Starting %s" % nw.__package__)
logger.debug("Initialising GUI ...") logger.debug("Initialising GUI ...")
self.mainConf = nw.CONFIG self.mainConf = nw.CONFIG
@@ -232,6 +231,8 @@ class GuiMain(QMainWindow):
else: else:
self.manageProjects() self.manageProjects()
logger.debug("%s is ready ..." % nw.__package__)
return return
def clearGUI(self): def clearGUI(self):
@@ -435,6 +436,8 @@ class GuiMain(QMainWindow):
if self.theIndex.indexBroken: if self.theIndex.indexBroken:
self.rebuildIndex() self.rebuildIndex()
logger.debug("Project load complete")
return True return True
def saveProject(self, autoSave=False): def saveProject(self, autoSave=False):