Files
novelWriter/nw/gui/statusbar.py
T
Veronica K. B. Olsen 2e2c84ea60 Added status bar class
2019-04-20 17:45:20 +02:00

69 lines
1.7 KiB
Python
Raw Blame History

This file contains ambiguous Unicode characters
This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.
# -*- coding: utf-8 -*-
"""novelWriter GUI Main Window StatusBar
novelWriter GUI Main Window StatusBar
=========================================
Class holding the main window status bar
File History:
Created: 2019-04-20 [0.0.1]
"""
import logging
import nw
from os import path
from PyQt5.QtWidgets import QStatusBar, QLabel
logger = logging.getLogger(__name__)
class GuiMainStatus(QStatusBar):
def __init__(self):
QStatusBar.__init__(self)
logger.debug("Initialising GuiMainStatus ...")
self.mainConf = nw.CONFIG
self.boxWordCount = QLabel()
self.boxCharCount = QLabel()
self.boxDocHandle = QLabel()
self.addPermanentWidget(self.boxWordCount)
self.addPermanentWidget(self.boxCharCount)
if self.mainConf.debugGUI:
self.addPermanentWidget(self.boxDocHandle)
logger.debug("GuiMainStatus initialisation complete")
self.setWordCount(None)
self.setCharCount(None)
self.setDocHandleCount(None)
return
def setWordCount(self, theCount):
if theCount is None:
self.boxWordCount.setText("<b>Words:</b> --")
else:
self.boxWordCount.setText("<b>Words:</b> {:n}".format(theCount))
return
def setCharCount(self, theCount):
if theCount is None:
self.boxCharCount.setText("<b>Chars:</b> --")
else:
self.boxCharCount.setText("<b>Chars:</b> {:n}".format(theCount))
return
def setDocHandleCount(self, theHandle):
if theHandle is None:
self.boxDocHandle.setText("0000000000000")
else:
self.boxDocHandle.setText("%13s" % theHandle)
return
# END Class GuiMainStatus