CuraSplashScreen.py 1.3 KB

1234567891011121314151617181920212223242526272829303132
  1. # Copyright (c) 2015 Ultimaker B.V.
  2. # Uranium is released under the terms of the AGPLv3 or higher.
  3. from PyQt5.QtCore import Qt, QCoreApplication
  4. from PyQt5.QtGui import QPixmap, QColor, QFont, QFontMetrics
  5. from PyQt5.QtWidgets import QSplashScreen
  6. from UM.Resources import Resources
  7. from UM.Application import Application
  8. class CuraSplashScreen(QSplashScreen):
  9. def __init__(self):
  10. super().__init__()
  11. self._scale = round(QFontMetrics(QCoreApplication.instance().font()).ascent() / 12)
  12. splash_image = QPixmap(Resources.getPath(Resources.Images, "cura.png"))
  13. self.setPixmap(splash_image.scaled(splash_image.size() * self._scale))
  14. def drawContents(self, painter):
  15. painter.save()
  16. painter.setPen(QColor(0, 0, 0, 255))
  17. version = Application.getInstance().getVersion().split("-")
  18. painter.setFont(QFont("Proxima Nova Rg", 20 ))
  19. painter.drawText(0, 0, 330 * self._scale, 230 * self._scale, Qt.AlignHCenter | Qt.AlignBottom, version[0])
  20. if len(version) > 1:
  21. painter.setFont(QFont("Proxima Nova Rg", 12 ))
  22. painter.drawText(0, 0, 330 * self._scale, 255 * self._scale, Qt.AlignHCenter | Qt.AlignBottom, version[1])
  23. painter.restore()
  24. super().drawContents(painter)