mirror of
https://github.com/sunnypilot/sunnypilot.git
synced 2026-02-18 16:33:57 +08:00
Merge branch 'master' into input-dialog
This commit is contained in:
@@ -10,6 +10,7 @@ Quick start:
|
||||
* set `BURN_IN=1` to get a burn-in heatmap version of the UI
|
||||
* set `GRID=50` to show a 50-pixel alignment grid overlay
|
||||
* set `MAGIC_DEBUG=1` to show every dropped frames (only on device)
|
||||
* set `SUNNYPILOT_UI=0` to run the stock UI instead of the sunnypilot UI
|
||||
* https://www.raylib.com/cheatsheet/cheatsheet.html
|
||||
* https://electronstudio.github.io/raylib-python-cffi/README.html#quickstart
|
||||
|
||||
|
||||
@@ -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
system/ui/sunnypilot/lib/application.py
Normal file
15
system/ui/sunnypilot/lib/application.py
Normal 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
|
||||
Reference in New Issue
Block a user