This commit is contained in:
nayan
2025-12-03 23:15:11 -05:00
parent c0bffa2a8c
commit 3fe8e155b6
3 changed files with 14 additions and 4 deletions
@@ -0,0 +1,3 @@
version https://git-lfs.github.com/spec/v1
oid sha256:434a720871336d359378beff5ebff3f9fd654d958693d272c7c6f2e271c7e41c
size 47676
+1
View File
@@ -94,6 +94,7 @@ class FontWeight(StrEnum):
BOLD = "Inter-Bold.fnt"
SEMI_BOLD = "Inter-SemiBold.fnt"
UNIFONT = "unifont.fnt"
AUDIOWIDE = "Audiowide-Regular.fnt"
# Small UI fonts
DISPLAY_REGULAR = "Inter-Regular.fnt"
+10 -4
View File
@@ -3,7 +3,8 @@ import os
import pyray as rl
from openpilot.system.hardware import HARDWARE
from openpilot.system.ui.lib.application import gui_app
from openpilot.system.ui.lib.application import gui_app, FontWeight
from openpilot.system.ui.lib.text_measure import measure_text_cached
from openpilot.system.ui.widgets import Widget
@@ -12,13 +13,18 @@ class ScreenSaverSP(Widget):
super().__init__()
self.set_rect(rl.Rectangle(0, 0, gui_app.width, gui_app.height))
self._is_mici = HARDWARE.get_device_type() == 'mici' or (HARDWARE.get_device_type() == "pc" and os.getenv("BIG") != "1")
self.logo_width = self.logo_height = 120 if self._is_mici else 400
self.text = "sunnypilot"
self.font_size = 50 if self._is_mici else 200
self.font = gui_app.font(FontWeight.AUDIOWIDE)
text_size = measure_text_cached(self.font, self.text, self.font_size, 0)
self.logo_width = text_size.x
self.logo_height = text_size.y
self.x = 0.0
self.y = 100.0
self.vx = 120.0 if self._is_mici else 300.0
self.vy = 70.0 if self._is_mici else 200.0
self._logo = gui_app.texture("../../sunnypilot/selfdrive/assets/icons/sp-logo.png", self.logo_width, self.logo_height)
self.color = rl.Color(0, 255, 0, 255)
self._dismiss = False
@@ -63,5 +69,5 @@ class ScreenSaverSP(Widget):
self.set_rect(rect)
rl.clear_background(rl.BLACK)
rl.draw_texture_ex(self._logo, rl.Vector2(self.x, self.y), 0.0, 1.0, self.color)
rl.draw_text_ex(self.font, self.text, rl.Vector2(int(self.x), int(self.y)), self.font_size, 0, self.color)
return -1