diff --git a/nw/gui/elements/doceditor.py b/nw/gui/elements/doceditor.py index 30db23d0..db15998c 100644 --- a/nw/gui/elements/doceditor.py +++ b/nw/gui/elements/doceditor.py @@ -280,6 +280,7 @@ class GuiDocEditor(QTextEdit): def setDictionaries(self): self.theDict.setLanguage(self.mainConf.spellLanguage, self.theProject.projDict) + self.theParent.statusBar.setLanguage(self.mainConf.spellLanguage) return True def setSpellCheck(self, theMode): diff --git a/nw/gui/icons.py b/nw/gui/icons.py index c44f84e5..34b9f529 100644 --- a/nw/gui/icons.py +++ b/nw/gui/icons.py @@ -17,7 +17,7 @@ from os import path from PyQt5.QtCore import QSize from PyQt5.QtSvg import QSvgWidget -from PyQt5.QtGui import QIcon +from PyQt5.QtGui import QIcon, QPixmap logger = logging.getLogger(__name__) @@ -41,6 +41,7 @@ class GuiIcons: "search" : "edit-find", "replace" : "edit-find-replace", "time" : None, + "globe" : None, } DECO_MAP = { @@ -96,6 +97,11 @@ class GuiIcons: return self.qIcons[iconKey] return QIcon() + def getPixmap(self, iconKey, iconSize): + if iconKey in self.qIcons: + return self.qIcons[iconKey].pixmap(iconSize[0], iconSize[1], QIcon.Normal) + return QPixmap() + ## # Internal Functions ## diff --git a/nw/gui/statusbar.py b/nw/gui/statusbar.py index b7cc621a..002fe39b 100644 --- a/nw/gui/statusbar.py +++ b/nw/gui/statusbar.py @@ -19,6 +19,8 @@ from PyQt5.QtCore import Qt, QTimer from PyQt5.QtGui import QIcon, QColor, QPixmap, QFont from PyQt5.QtWidgets import QStatusBar, QLabel, QFrame +from nw.tools import NWSpellCheck + logger = logging.getLogger(__name__) class GuiMainStatus(QStatusBar): @@ -45,10 +47,13 @@ class GuiMainStatus(QStatusBar): self.boxStats = QLabel() self.boxStats.setToolTip("Project Word Count | Session Word Count") - self.boxTime = QLabel("") - self.boxTime.setToolTip("Session Time") - self.boxTime.setAlignment(Qt.AlignVCenter | Qt.AlignRight) - self.boxTime.setFont(self.monoFont) + self.timeBox = QLabel("") + self.timeBox.setToolTip("Session Time") + self.timeBox.setAlignment(Qt.AlignVCenter | Qt.AlignRight) + self.timeBox.setFont(self.monoFont) + + self.timeIcon = QLabel() + self.timeIcon.setPixmap(self.theParent.theTheme.getPixmap("time",(14,14))) self.boxCounts = QLabel() self.boxCounts.setToolTip("Document Character | Word | Paragraph Count") @@ -63,16 +68,22 @@ class GuiMainStatus(QStatusBar): self.docChanged.setFixedWidth(14) self.docChanged.setToolTip("Document Changes Saved") - self.docLanguage = QLabel("") + self.langBox = QLabel("None") + self.langIcon = QLabel("") + self.langIcon.setPixmap(self.theParent.theTheme.getPixmap("globe",(14,14))) # Add Them + self.addPermanentWidget(self.langIcon) + self.addPermanentWidget(self.langBox) + self.addPermanentWidget(QLabel(" ")) 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.addPermanentWidget(self.timeIcon) + self.addPermanentWidget(self.timeBox) self.setSizeGripEnabled(True) @@ -104,6 +115,10 @@ class GuiMainStatus(QStatusBar): self.showMessage(theMessage, int(timeOut*1000)) return + def setLanguage(self, theLanguage): + self.langBox.setText(NWSpellCheck.expandLanguage(theLanguage)) + return + def setProjectStatus(self, isChanged): if isChanged is None: self.projChanged.setPixmap(self.iconGrey) @@ -149,7 +164,7 @@ class GuiMainStatus(QStatusBar): tM = tM - tH*60 tS = tS - tM*60 - tH*3600 theTime = "%02d:%02d:%02d" % (tH,tM,tS) - self.boxTime.setText(theTime) + self.timeBox.setText(theTime) return # END Class GuiMainStatus diff --git a/nw/gui/theme.py b/nw/gui/theme.py index bf6a0121..ecfb6d04 100644 --- a/nw/gui/theme.py +++ b/nw/gui/theme.py @@ -91,6 +91,7 @@ class GuiTheme: self.updateTheme() self.getIcon = self.theIcons.getIcon + self.getPixmap = self.theIcons.getPixmap self.loadDecoration = self.theIcons.loadDecoration return