Updated icon and font for session timer, and added language info for status bar

This commit is contained in:
Veronica K. B. Olsen
2019-11-08 19:56:38 +01:00
parent 7fcd0731bf
commit f01c2f9dee
4 changed files with 31 additions and 8 deletions
+1
View File
@@ -280,6 +280,7 @@ class GuiDocEditor(QTextEdit):
def setDictionaries(self): def setDictionaries(self):
self.theDict.setLanguage(self.mainConf.spellLanguage, self.theProject.projDict) self.theDict.setLanguage(self.mainConf.spellLanguage, self.theProject.projDict)
self.theParent.statusBar.setLanguage(self.mainConf.spellLanguage)
return True return True
def setSpellCheck(self, theMode): def setSpellCheck(self, theMode):
+7 -1
View File
@@ -17,7 +17,7 @@ from os import path
from PyQt5.QtCore import QSize from PyQt5.QtCore import QSize
from PyQt5.QtSvg import QSvgWidget from PyQt5.QtSvg import QSvgWidget
from PyQt5.QtGui import QIcon from PyQt5.QtGui import QIcon, QPixmap
logger = logging.getLogger(__name__) logger = logging.getLogger(__name__)
@@ -41,6 +41,7 @@ class GuiIcons:
"search" : "edit-find", "search" : "edit-find",
"replace" : "edit-find-replace", "replace" : "edit-find-replace",
"time" : None, "time" : None,
"globe" : None,
} }
DECO_MAP = { DECO_MAP = {
@@ -96,6 +97,11 @@ class GuiIcons:
return self.qIcons[iconKey] return self.qIcons[iconKey]
return QIcon() 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 # Internal Functions
## ##
+22 -7
View File
@@ -19,6 +19,8 @@ from PyQt5.QtCore import Qt, QTimer
from PyQt5.QtGui import QIcon, QColor, QPixmap, QFont from PyQt5.QtGui import QIcon, QColor, QPixmap, QFont
from PyQt5.QtWidgets import QStatusBar, QLabel, QFrame from PyQt5.QtWidgets import QStatusBar, QLabel, QFrame
from nw.tools import NWSpellCheck
logger = logging.getLogger(__name__) logger = logging.getLogger(__name__)
class GuiMainStatus(QStatusBar): class GuiMainStatus(QStatusBar):
@@ -45,10 +47,13 @@ class GuiMainStatus(QStatusBar):
self.boxStats = QLabel() self.boxStats = QLabel()
self.boxStats.setToolTip("Project Word Count | Session Word Count") self.boxStats.setToolTip("Project Word Count | Session Word Count")
self.boxTime = QLabel("") self.timeBox = QLabel("")
self.boxTime.setToolTip("Session Time") self.timeBox.setToolTip("Session Time")
self.boxTime.setAlignment(Qt.AlignVCenter | Qt.AlignRight) self.timeBox.setAlignment(Qt.AlignVCenter | Qt.AlignRight)
self.boxTime.setFont(self.monoFont) self.timeBox.setFont(self.monoFont)
self.timeIcon = QLabel()
self.timeIcon.setPixmap(self.theParent.theTheme.getPixmap("time",(14,14)))
self.boxCounts = QLabel() self.boxCounts = QLabel()
self.boxCounts.setToolTip("Document Character | Word | Paragraph Count") self.boxCounts.setToolTip("Document Character | Word | Paragraph Count")
@@ -63,16 +68,22 @@ class GuiMainStatus(QStatusBar):
self.docChanged.setFixedWidth(14) self.docChanged.setFixedWidth(14)
self.docChanged.setToolTip("Document Changes Saved") 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 # Add Them
self.addPermanentWidget(self.langIcon)
self.addPermanentWidget(self.langBox)
self.addPermanentWidget(QLabel(" "))
self.addPermanentWidget(self.docChanged) self.addPermanentWidget(self.docChanged)
self.addPermanentWidget(self.boxCounts) self.addPermanentWidget(self.boxCounts)
self.addPermanentWidget(QLabel(" ")) self.addPermanentWidget(QLabel(" "))
self.addPermanentWidget(self.projChanged) self.addPermanentWidget(self.projChanged)
self.addPermanentWidget(self.boxStats) self.addPermanentWidget(self.boxStats)
self.addPermanentWidget(QLabel(" ")) self.addPermanentWidget(QLabel(" "))
self.addPermanentWidget(self.boxTime) self.addPermanentWidget(self.timeIcon)
self.addPermanentWidget(self.timeBox)
self.setSizeGripEnabled(True) self.setSizeGripEnabled(True)
@@ -104,6 +115,10 @@ class GuiMainStatus(QStatusBar):
self.showMessage(theMessage, int(timeOut*1000)) self.showMessage(theMessage, int(timeOut*1000))
return return
def setLanguage(self, theLanguage):
self.langBox.setText(NWSpellCheck.expandLanguage(theLanguage))
return
def setProjectStatus(self, isChanged): def setProjectStatus(self, isChanged):
if isChanged is None: if isChanged is None:
self.projChanged.setPixmap(self.iconGrey) self.projChanged.setPixmap(self.iconGrey)
@@ -149,7 +164,7 @@ class GuiMainStatus(QStatusBar):
tM = tM - tH*60 tM = tM - tH*60
tS = tS - tM*60 - tH*3600 tS = tS - tM*60 - tH*3600
theTime = "%02d:%02d:%02d" % (tH,tM,tS) theTime = "%02d:%02d:%02d" % (tH,tM,tS)
self.boxTime.setText(theTime) self.timeBox.setText(theTime)
return return
# END Class GuiMainStatus # END Class GuiMainStatus
+1
View File
@@ -91,6 +91,7 @@ class GuiTheme:
self.updateTheme() self.updateTheme()
self.getIcon = self.theIcons.getIcon self.getIcon = self.theIcons.getIcon
self.getPixmap = self.theIcons.getPixmap
self.loadDecoration = self.theIcons.loadDecoration self.loadDecoration = self.theIcons.loadDecoration
return return