mirror of
https://github.com/Ultimaker/Cura.git
synced 2025-08-05 21:13:58 -06:00
Redesign splash window
CURA-4215 - Rectangle splash window - Fix for splash window crash - Enable antialias - Fix for longer loading text in some languages
This commit is contained in:
parent
6f512e9f97
commit
7144720d78
3 changed files with 14 additions and 11 deletions
|
@ -2,10 +2,9 @@
|
|||
# Uranium is released under the terms of the AGPLv3 or higher.
|
||||
|
||||
from threading import Thread, Event
|
||||
import time
|
||||
|
||||
from PyQt5.QtCore import Qt, QCoreApplication
|
||||
from PyQt5.QtGui import QPixmap, QColor, QFont, QFontMetrics, QImage, QPen
|
||||
from PyQt5.QtCore import Qt
|
||||
from PyQt5.QtGui import QPixmap, QColor, QFont, QPen, QPainter
|
||||
from PyQt5.QtWidgets import QSplashScreen
|
||||
|
||||
from UM.Resources import Resources
|
||||
|
@ -22,8 +21,6 @@ class CuraSplashScreen(QSplashScreen):
|
|||
|
||||
self._current_message = ""
|
||||
|
||||
self._loading_image = QImage(Resources.getPath(Resources.Images, "loading.png"))
|
||||
self._loading_image = self._loading_image.scaled(30, 30, Qt.KeepAspectRatio)
|
||||
self._loading_image_rotation_angle = 0
|
||||
|
||||
self._to_stop = False
|
||||
|
@ -46,6 +43,8 @@ class CuraSplashScreen(QSplashScreen):
|
|||
|
||||
painter.save()
|
||||
painter.setPen(QColor(255, 255, 255, 255))
|
||||
painter.setRenderHint(QPainter.Antialiasing)
|
||||
painter.setRenderHint(QPainter.Antialiasing, True)
|
||||
|
||||
version = Application.getInstance().getVersion().split("-")
|
||||
buildtype = Application.getInstance().getBuildType()
|
||||
|
@ -56,25 +55,30 @@ class CuraSplashScreen(QSplashScreen):
|
|||
font = QFont() # Using system-default font here
|
||||
font.setPointSize(34)
|
||||
painter.setFont(font)
|
||||
painter.drawText(275, 87, 330 * self._scale, 230 * self._scale, Qt.AlignLeft | Qt.AlignBottom, version[0])
|
||||
painter.drawText(300, 110, 330 * self._scale, 230 * self._scale, Qt.AlignLeft | Qt.AlignTop, version[0])
|
||||
if len(version) > 1:
|
||||
font.setPointSize(12)
|
||||
painter.setFont(font)
|
||||
painter.drawText(320, 82, 330 * self._scale, 255 * self._scale, Qt.AlignLeft | Qt.AlignBottom, version[1])
|
||||
painter.setPen(QColor(200, 200, 200, 255))
|
||||
painter.drawText(343, 160, 330 * self._scale, 255 * self._scale, Qt.AlignLeft | Qt.AlignTop, version[1])
|
||||
painter.setPen(QColor(255, 255, 255, 255))
|
||||
|
||||
# draw the loading image
|
||||
pen = QPen()
|
||||
pen.setWidth(4 * self._scale)
|
||||
pen.setWidth(6 * self._scale)
|
||||
pen.setColor(QColor(255, 255, 255, 255))
|
||||
painter.setPen(pen)
|
||||
painter.drawArc(130, 380, 32 * self._scale, 32 * self._scale, self._loading_image_rotation_angle * 16, 300 * 16)
|
||||
#painter.drawArc(100, 350, 32 * self._scale, 32 * self._scale, self._loading_image_rotation_angle * 16, 300 * 16)
|
||||
painter.drawArc(60, 350, 32 * self._scale, 32 * self._scale, self._loading_image_rotation_angle * 16, 300 * 16)
|
||||
|
||||
# draw message text
|
||||
if self._current_message:
|
||||
font = QFont() # Using system-default font here
|
||||
font.setPointSize(16)
|
||||
painter.setFont(font)
|
||||
painter.drawText(180, 243, 330 * self._scale, 230 * self._scale, Qt.AlignLeft | Qt.AlignBottom,
|
||||
#painter.drawText(150, 328, 316, 64,
|
||||
painter.drawText(100, 328, 260, 64,
|
||||
Qt.AlignLeft | Qt.AlignVCenter | Qt.TextWordWrap,
|
||||
self._current_message)
|
||||
|
||||
painter.restore()
|
||||
|
@ -86,7 +90,6 @@ class CuraSplashScreen(QSplashScreen):
|
|||
|
||||
self._current_message = message
|
||||
self.messageChanged.emit(message)
|
||||
self.repaint()
|
||||
|
||||
def close(self):
|
||||
# set stop flags
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue