Files
StarPilot/selfdrive/ui/onroad/starpilot/widgets/base.py
T
2026-07-19 17:57:33 -04:00

24 lines
709 B
Python

import pyray as rl
from abc import abstractmethod
from openpilot.system.ui.widgets import Widget
class LayoutWidget(Widget):
def __init__(self, name: str, priority: int):
super().__init__()
self.name = name
self.priority = priority
@property
@abstractmethod
def is_visible(self) -> bool:
"""Returns True if the widget should currently be displayed."""
@abstractmethod
def get_size(self) -> tuple[float, float]:
"""Returns the width and height of the widget as (width, height)."""
def _render(self, rect: rl.Rectangle) -> bool | int | None:
# Subclasses will implement self._render instead of render
# to integrate with openpilot.system.ui.widgets.Widget
pass