Skip to content

Commit

Permalink
Merge pull request #420 from vkbo/issue_418
Browse files Browse the repository at this point in the history
Issue #418: Error printout in the logger
  • Loading branch information
vkbo committed Aug 18, 2020
2 parents 752be16 + b404a10 commit dbe7b80
Showing 1 changed file with 17 additions and 11 deletions.
28 changes: 17 additions & 11 deletions nw/gui/doceditor.py
Original file line number Diff line number Diff line change
Expand Up @@ -1936,6 +1936,7 @@ def __init__(self, docEditor):
self.theTheme = docEditor.theTheme
self.optState = docEditor.theProject.optState
self.theHandle = None
self.theItem = None

# Make a QPalette that matches the Syntax Theme
self.thePalette = QPalette()
Expand Down Expand Up @@ -2009,27 +2010,33 @@ def setHandle(self, tHandle):
"""Set the handle that will populate the footer's data.
"""
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.updateCounts()

return

def updateInfo(self):
"""Update the content of text labels.
"""
nwItem = self.theProject.projTree[self.theHandle]
if nwItem is None:
sIcon = QPixmap()
sText = ""
if self.theItem is None:
sIcon = QPixmap()
sText = ""
else:
iStatus = nwItem.itemStatus
if nwItem.itemClass == nwItemClass.NOVEL:
iStatus = self.theItem.itemStatus
if self.theItem.itemClass == nwItemClass.NOVEL:
iStatus = self.theProject.statusItems.checkEntry(iStatus)
theIcon = self.theParent.statusIcons[iStatus]
else:
iStatus = self.theProject.importItems.checkEntry(iStatus)
theIcon = self.theParent.importIcons[iStatus]
sIcon = theIcon.pixmap(self.sPx, self.sPx)
sText = nwItem.itemStatus
sText = self.theItem.itemStatus

self.statusIcon.setPixmap(sIcon)
self.statusText.setText(sText)
Expand All @@ -2039,13 +2046,12 @@ def updateInfo(self):
def updateCounts(self):
"""Update the word counts.
"""
nwItem = self.theProject.projTree[self.theHandle]
if nwItem is None:
if self.theItem is None:
wCount = 0
wDiff = 0
else:
wCount = nwItem.wordCount
wDiff = wCount - nwItem.initCount
wCount = self.theItem.wordCount
wDiff = wCount - self.theItem.initCount

self.wordsText.setText("Words: {:n} ({:+n})".format(wCount, wDiff))

Expand Down

0 comments on commit dbe7b80

Please sign in to comment.