Added variables for font metrics to theme class
This commit is contained in:
+15
-3
@@ -32,7 +32,7 @@ import nw
|
|||||||
from os import path, listdir
|
from os import path, listdir
|
||||||
|
|
||||||
from PyQt5.QtWidgets import qApp
|
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.constants import nwAlert
|
||||||
from nw.gui.icons import GuiIcons
|
from nw.gui.icons import GuiIcons
|
||||||
@@ -119,8 +119,20 @@ class GuiTheme:
|
|||||||
self.loadDecoration = self.theIcons.loadDecoration
|
self.loadDecoration = self.theIcons.loadDecoration
|
||||||
|
|
||||||
# Extract Other Info
|
# Extract Other Info
|
||||||
self.defFont = qApp.font()
|
self.guiDPI = qApp.primaryScreen().physicalDotsPerInch()
|
||||||
self.defFontSize = self.defFont.pointSizeF()
|
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
|
return
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user