From aef6b339e10375ccd3d83cbb9b4cedf50b39320a Mon Sep 17 00:00:00 2001 From: "Veronica K. B. Olsen" <1619840+vkbo@users.noreply.github.com> Date: Fri, 8 Nov 2019 13:38:08 +0100 Subject: [PATCH] Minor changes to statusbar layout --- nw/gui/statusbar.py | 25 +++++++++++++++---------- nw/theme.py | 11 ++++++++--- 2 files changed, 23 insertions(+), 13 deletions(-) diff --git a/nw/gui/statusbar.py b/nw/gui/statusbar.py index ef082e2f..b7cc621a 100644 --- a/nw/gui/statusbar.py +++ b/nw/gui/statusbar.py @@ -16,7 +16,7 @@ import nw from time import time from PyQt5.QtCore import Qt, QTimer -from PyQt5.QtGui import QIcon, QColor, QPixmap +from PyQt5.QtGui import QIcon, QColor, QPixmap, QFont from PyQt5.QtWidgets import QStatusBar, QLabel, QFrame logger = logging.getLogger(__name__) @@ -28,14 +28,16 @@ class GuiMainStatus(QStatusBar): logger.debug("Initialising MainStatus ...") - self.mainConf = nw.CONFIG - self.theParent = theParent - self.refTime = None + self.mainConf = nw.CONFIG + self.theParent = theParent + self.refTime = None self.iconGrey = QPixmap(16,16) self.iconYellow = QPixmap(16,16) self.iconGreen = QPixmap(16,16) + self.monoFont = QFont("Monospace",10) + self.iconGrey.fill(QColor(*self.theParent.theTheme.statNone)) self.iconYellow.fill(QColor(*self.theParent.theTheme.statUnsaved)) self.iconGreen.fill(QColor(*self.theParent.theTheme.statSaved)) @@ -45,28 +47,31 @@ class GuiMainStatus(QStatusBar): self.boxTime = QLabel("") self.boxTime.setToolTip("Session Time") - self.boxTime.setAlignment(Qt.AlignRight) - self.boxTime.setMinimumWidth(80) + self.boxTime.setAlignment(Qt.AlignVCenter | Qt.AlignRight) + self.boxTime.setFont(self.monoFont) self.boxCounts = QLabel() self.boxCounts.setToolTip("Document Character | Word | Paragraph Count") self.projChanged = QLabel("") - self.projChanged.setFixedHeight(16) - self.projChanged.setFixedWidth(16) + self.projChanged.setFixedHeight(14) + self.projChanged.setFixedWidth(14) self.projChanged.setToolTip("Project Changes Saved") self.docChanged = QLabel("") - self.docChanged.setFixedHeight(16) - self.docChanged.setFixedWidth(16) + self.docChanged.setFixedHeight(14) + self.docChanged.setFixedWidth(14) self.docChanged.setToolTip("Document Changes Saved") + self.docLanguage = QLabel("") + # Add Them self.addPermanentWidget(self.docChanged) self.addPermanentWidget(self.boxCounts) self.addPermanentWidget(QLabel(" ")) self.addPermanentWidget(self.projChanged) self.addPermanentWidget(self.boxStats) + self.addPermanentWidget(QLabel(" ")) self.addPermanentWidget(self.boxTime) self.setSizeGripEnabled(True) diff --git a/nw/theme.py b/nw/theme.py index 157b26a3..5c05c0dd 100644 --- a/nw/theme.py +++ b/nw/theme.py @@ -17,7 +17,7 @@ import nw from os import path, listdir from PyQt5.QtWidgets import qApp -from PyQt5.QtGui import QPalette, QColor, QIcon +from PyQt5.QtGui import QPalette, QColor, QIcon, QPixmap from nw.constants import nwAlert @@ -253,7 +253,7 @@ class Theme: try: confParser.read_file(open(themeConf, mode="r", encoding="utf8")) except Exception as e: - self.theParent.makeAlert(["Could not load theme config file",str(e)],nwAlert.ERROR) + self.theParent.makeAlert(["Could not load theme config file.",str(e)],nwAlert.ERROR) continue themeName = "" if confParser.has_section("Main"): @@ -281,7 +281,7 @@ class Theme: try: confParser.read_file(open(syntaxPath, mode="r", encoding="utf8")) except Exception as e: - self.theParent.makeAlert(["Could not load syntax file",str(e)],nwAlert.ERROR) + self.theParent.makeAlert(["Could not load syntax file.",str(e)],nwAlert.ERROR) return [] syntaxName = "" if confParser.has_section("Main"): @@ -299,6 +299,11 @@ class Theme: return self.themeIcons[iconName] return QIcon() + def getIconPixmap(self, iconName, iconSize=None): + if iconName in self.themeIcons: + return self.themeIcons[iconName].pixmap() + return QPixmap() + ## # Internal Functions ##