Merge pull request #420 from vkbo/issue_418

Issue #418: Error printout in the logger
This commit is contained in:
Veronica K. Berglyd Olsen
2020-08-18 20:59:56 +02:00
committed by GitHub
+17 -11
View File
@@ -1936,6 +1936,7 @@ class GuiDocEditFooter(QWidget):
self.theTheme = docEditor.theTheme self.theTheme = docEditor.theTheme
self.optState = docEditor.theProject.optState self.optState = docEditor.theProject.optState
self.theHandle = None self.theHandle = None
self.theItem = None
# Make a QPalette that matches the Syntax Theme # Make a QPalette that matches the Syntax Theme
self.thePalette = QPalette() self.thePalette = QPalette()
@@ -2009,27 +2010,33 @@ class GuiDocEditFooter(QWidget):
"""Set the handle that will populate the footer's data. """Set the handle that will populate the footer's data.
""" """
self.theHandle = tHandle self.theHandle = tHandle
if self.theHandle is None:
logger.verbose("No handle set, so clearing the editor footer")
self.theItem = None
else:
self.theItem = self.theProject.projTree[self.theHandle]
self.updateInfo() self.updateInfo()
self.updateCounts() self.updateCounts()
return return
def updateInfo(self): def updateInfo(self):
"""Update the content of text labels. """Update the content of text labels.
""" """
nwItem = self.theProject.projTree[self.theHandle] if self.theItem is None:
if nwItem is None: sIcon = QPixmap()
sIcon = QPixmap() sText = ""
sText = ""
else: else:
iStatus = nwItem.itemStatus iStatus = self.theItem.itemStatus
if nwItem.itemClass == nwItemClass.NOVEL: if self.theItem.itemClass == nwItemClass.NOVEL:
iStatus = self.theProject.statusItems.checkEntry(iStatus) iStatus = self.theProject.statusItems.checkEntry(iStatus)
theIcon = self.theParent.statusIcons[iStatus] theIcon = self.theParent.statusIcons[iStatus]
else: else:
iStatus = self.theProject.importItems.checkEntry(iStatus) iStatus = self.theProject.importItems.checkEntry(iStatus)
theIcon = self.theParent.importIcons[iStatus] theIcon = self.theParent.importIcons[iStatus]
sIcon = theIcon.pixmap(self.sPx, self.sPx) sIcon = theIcon.pixmap(self.sPx, self.sPx)
sText = nwItem.itemStatus sText = self.theItem.itemStatus
self.statusIcon.setPixmap(sIcon) self.statusIcon.setPixmap(sIcon)
self.statusText.setText(sText) self.statusText.setText(sText)
@@ -2039,13 +2046,12 @@ class GuiDocEditFooter(QWidget):
def updateCounts(self): def updateCounts(self):
"""Update the word counts. """Update the word counts.
""" """
nwItem = self.theProject.projTree[self.theHandle] if self.theItem is None:
if nwItem is None:
wCount = 0 wCount = 0
wDiff = 0 wDiff = 0
else: else:
wCount = nwItem.wordCount wCount = self.theItem.wordCount
wDiff = wCount - nwItem.initCount wDiff = wCount - self.theItem.initCount
self.wordsText.setText("Words: {:n} ({:+n})".format(wCount, wDiff)) self.wordsText.setText("Words: {:n} ({:+n})".format(wCount, wDiff))