|
15 | 15 |
|
16 | 16 | _SPLASH_CACHE = Path("/home/blocks/.cache/blockscreen/splash.raw") |
17 | 17 | _FB0 = Path("/dev/fb0") |
18 | | -_LOGO = Path(__file__).parent / "lib/ui/resources/logoblocks.png" |
| 18 | +_LOGO: Path | None = next( |
| 19 | + ( |
| 20 | + p |
| 21 | + for p in [ |
| 22 | + Path(__file__).parent / "lib/ui/resources/media/logoblocks400x300.png", |
| 23 | + Path(__file__).parent / "lib/ui/resources/media/logoblocks.png", |
| 24 | + Path(__file__).parent / "lib/ui/resources/media/graphics/logo_blocks.png", |
| 25 | + ] |
| 26 | + if p.exists() |
| 27 | + ), |
| 28 | + None, |
| 29 | +) |
19 | 30 |
|
20 | 31 |
|
21 | 32 | class BlocksScreenApp(QtWidgets.QApplication): |
@@ -63,18 +74,32 @@ def _write_splash_to_fb0() -> None: |
63 | 74 | def show_splash() -> QtWidgets.QSplashScreen: |
64 | 75 | """Show a fullscreen splash immediately after QApplication is created. |
65 | 76 |
|
66 | | - Centres the logo on a black background matching the current screen geometry. |
| 77 | + Centres the logo on a dark background matching the current screen geometry, |
| 78 | + with a 'Restarting ...' message below the logo. |
67 | 79 | Returns the QSplashScreen so the caller can call splash.finish(main_window). |
68 | 80 | """ |
69 | | - logo = QtGui.QPixmap(str(_LOGO)) |
| 81 | + logo = QtGui.QPixmap(str(_LOGO)) if _LOGO is not None else QtGui.QPixmap() |
70 | 82 | screen = QtWidgets.QApplication.primaryScreen() |
71 | 83 | if screen is not None: |
72 | 84 | geom = screen.geometry() |
73 | 85 | bg = QtGui.QPixmap(geom.size()) |
74 | | - bg.fill(QtGui.QColor(0, 0, 0)) |
| 86 | + bg.fill(QtGui.QColor(20, 20, 20)) |
75 | 87 | painter = QtGui.QPainter(bg) |
76 | | - painter.drawPixmap( |
77 | | - (bg.width() - logo.width()) // 2, (bg.height() - logo.height()) // 2, logo |
| 88 | + lx = (bg.width() - logo.width()) // 2 |
| 89 | + ly = (bg.height() - logo.height()) // 2 |
| 90 | + if not logo.isNull(): |
| 91 | + painter.drawPixmap(lx, ly, logo) |
| 92 | + font = painter.font() |
| 93 | + font.setPointSize(14) |
| 94 | + painter.setFont(font) |
| 95 | + painter.setPen(QtGui.QColor(180, 180, 180)) |
| 96 | + painter.drawText( |
| 97 | + 0, |
| 98 | + ly + logo.height() + 24, |
| 99 | + bg.width(), |
| 100 | + 32, |
| 101 | + QtCore.Qt.AlignmentFlag.AlignHCenter, |
| 102 | + "Restarting ...", |
78 | 103 | ) |
79 | 104 | painter.end() |
80 | 105 | splash = QtWidgets.QSplashScreen(bg, QtCore.Qt.WindowType.WindowStaysOnTopHint) |
|
0 commit comments