From fa9f4ca0bae63b17937c676800fcf80889c70030 Mon Sep 17 00:00:00 2001 From: fieldOfView Date: Wed, 16 Dec 2015 13:42:13 +0100 Subject: [PATCH] Fix splashscreen size on HiDPI (windows) screens --- cura/CuraSplashScreen.py | 17 ++++++++++------- 1 file changed, 10 insertions(+), 7 deletions(-) diff --git a/cura/CuraSplashScreen.py b/cura/CuraSplashScreen.py index 07f88fc843..d27c9c0240 100644 --- a/cura/CuraSplashScreen.py +++ b/cura/CuraSplashScreen.py @@ -1,8 +1,8 @@ # Copyright (c) 2015 Ultimaker B.V. # Uranium is released under the terms of the AGPLv3 or higher. -from PyQt5.QtCore import Qt -from PyQt5.QtGui import QPixmap, QColor, QFont +from PyQt5.QtCore import Qt, QCoreApplication +from PyQt5.QtGui import QPixmap, QColor, QFont, QFontMetrics from PyQt5.QtWidgets import QSplashScreen from UM.Resources import Resources @@ -11,7 +11,10 @@ from UM.Application import Application class CuraSplashScreen(QSplashScreen): def __init__(self): super().__init__() - self.setPixmap(QPixmap(Resources.getPath(Resources.Images, "cura.png"))) + self._scale = round(QFontMetrics(QCoreApplication.instance().font()).ascent() / 12) + + splash_image = QPixmap(Resources.getPath(Resources.Images, "cura.png")) + self.setPixmap(splash_image.scaled(splash_image.size() * self._scale)) def drawContents(self, painter): painter.save() @@ -19,11 +22,11 @@ class CuraSplashScreen(QSplashScreen): version = Application.getInstance().getVersion().split("-") - painter.setFont(QFont("Proxima Nova Rg", 20)) - painter.drawText(0, 0, 203, 230, Qt.AlignRight | Qt.AlignBottom, version[0]) + painter.setFont(QFont("Proxima Nova Rg", 20 )) + painter.drawText(0, 0, 330 * self._scale, 230 * self._scale, Qt.AlignHCenter | Qt.AlignBottom, version[0]) if len(version) > 1: - painter.setFont(QFont("Proxima Nova Rg", 12)) - painter.drawText(0, 0, 203, 255, Qt.AlignRight | Qt.AlignBottom, version[1]) + painter.setFont(QFont("Proxima Nova Rg", 12 )) + painter.drawText(0, 0, 330 * self._scale, 255 * self._scale, Qt.AlignHCenter | Qt.AlignBottom, version[1]) painter.restore() super().drawContents(painter)