Minor changes to statusbar layout
This commit is contained in:
+15
-10
@@ -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)
|
||||
|
||||
+8
-3
@@ -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
|
||||
##
|
||||
|
||||
Reference in New Issue
Block a user