Scale factor calculated from logical dpi

This commit is contained in:
Veronica K. B. Olsen
2020-06-04 22:36:31 +02:00
parent 8b22deb1f4
commit ba4922a426
2 changed files with 8 additions and 4 deletions
+2 -2
View File
@@ -172,7 +172,7 @@ def main(sysArgs=None):
debugLevel = logging.INFO debugLevel = logging.INFO
elif inOpt == "--debug": elif inOpt == "--debug":
debugLevel = logging.DEBUG debugLevel = logging.DEBUG
logFormat = "[{asctime:}] {name:>20}:{lineno:<4d} {levelname:8} {message:}" logFormat = "[{asctime:}] {name:>22}:{lineno:<4d} {levelname:8} {message:}"
elif inOpt == "--logfile": elif inOpt == "--logfile":
logFile = inArg logFile = inArg
toFile = True toFile = True
@@ -180,7 +180,7 @@ def main(sysArgs=None):
toStd = False toStd = False
elif inOpt == "--verbose": elif inOpt == "--verbose":
debugLevel = VERBOSE debugLevel = VERBOSE
logFormat = "[{asctime:}] {name:>20}:{lineno:<4d} {levelname:8} {message:}" logFormat = "[{asctime:}] {name:>22}:{lineno:<4d} {levelname:8} {message:}"
elif inOpt == "--style": elif inOpt == "--style":
qtStyle = inArg qtStyle = inArg
elif inOpt == "--config": elif inOpt == "--config":
+6 -2
View File
@@ -132,9 +132,13 @@ class GuiTheme:
self.loadDecoration = self.theIcons.loadDecoration self.loadDecoration = self.theIcons.loadDecoration
# Extract Other Info # Extract Other Info
self.guiDPI = qApp.primaryScreen().physicalDotsPerInch() self.guiDPI = qApp.primaryScreen().physicalDotsPerInchX()
self.guiFont = qApp.font() self.guiScale = qApp.primaryScreen().logicalDotsPerInchX()/96.0
self.mainConf.guiScale = self.guiScale
logger.verbose("GUI DPI: %.1f" % self.guiDPI)
logger.verbose("GUI Scale: %.2f" % self.guiScale)
self.guiFont = qApp.font()
qMetric = QFontMetrics(self.guiFont) qMetric = QFontMetrics(self.guiFont)
self.fontPointSize = self.guiFont.pointSizeF() self.fontPointSize = self.guiFont.pointSizeF()
self.fontPixelSize = int(round(qMetric.height())) self.fontPixelSize = int(round(qMetric.height()))