mirror of
https://git.mirrors.martin98.com/https://github.com/Ultimaker/Cura
synced 2025-08-12 17:28:59 +08:00
Fix splashscreen size on HiDPI (windows) screens
This commit is contained in:
parent
4bf4a20d44
commit
fa9f4ca0ba
@ -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)
|
||||
|
Loading…
x
Reference in New Issue
Block a user