ui: GuiApplicationExt

This commit is contained in:
Jason Wen
2025-11-21 16:23:01 -05:00
parent 0ba5cbea91
commit 91f2bf3459
2 changed files with 18 additions and 1 deletions
+3 -1
View File
@@ -19,6 +19,8 @@ from openpilot.system.hardware import HARDWARE, PC
from openpilot.system.ui.lib.multilang import multilang
from openpilot.common.realtime import Ratekeeper
from openpilot.system.ui.sunnypilot.lib.application import GuiApplicationExt
_DEFAULT_FPS = int(os.getenv("FPS", {'tizi': 20}.get(HARDWARE.get_device_type(), 60)))
FPS_LOG_INTERVAL = 5 # Seconds between logging FPS drops
FPS_DROP_THRESHOLD = 0.9 # FPS drop threshold for triggering a warning
@@ -186,7 +188,7 @@ class MouseState:
self._prev_mouse_event[slot] = ev
class GuiApplication:
class GuiApplication(GuiApplicationExt):
def __init__(self, width: int | None = None, height: int | None = None):
self._fonts: dict[FontWeight, rl.Font] = {}
self._width = width if width is not None else GuiApplication._default_width()
+15
View File
@@ -0,0 +1,15 @@
"""
Copyright (c) 2021-, Haibin Wen, sunnypilot, and a number of other contributors.
This file is part of sunnypilot and is licensed under the MIT License.
See the LICENSE.md file in the root directory for more details.
"""
import os
SUNNYPILOT_UI = os.getenv("SUNNYPILOT_UI", "1") == "1"
class GuiApplicationExt:
@staticmethod
def sunnypilot_ui() -> bool:
return SUNNYPILOT_UI