Added variables for font metrics to theme class

This commit is contained in:
Veronica K. B. Olsen
2020-05-30 20:52:19 +02:00
parent 3487817065
commit 586535de92
+15 -3
View File
@@ -32,7 +32,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, QFontMetrics
from nw.constants import nwAlert
from nw.gui.icons import GuiIcons
@@ -119,8 +119,20 @@ class GuiTheme:
self.loadDecoration = self.theIcons.loadDecoration
# Extract Other Info
self.defFont = qApp.font()
self.defFontSize = self.defFont.pointSizeF()
self.guiDPI = qApp.primaryScreen().physicalDotsPerInch()
self.guiFont = qApp.font()
qMetric = QFontMetrics(self.guiFont)
self.fontPointSize = self.guiFont.pointSizeF()
self.fontPixelSize = qMetric.height()
self.baseIconSize = qMetric.ascent()
self.textIconSize = qMetric.ascent() + qMetric.leading()
logger.verbose("GUI Font Family: %s" % self.guiFont.family())
logger.verbose("GUI Font Point Size: %.2f" % self.fontPointSize)
logger.verbose("GUI Font Pixel Size: %.2f" % self.fontPixelSize)
logger.verbose("GUI Base Icon Size: %.2f" % self.baseIconSize)
logger.verbose("GUI Text Icon Size: %.2f" % self.textIconSize)
return