mirror of
https://github.com/firestar5683/StarPilot.git
synced 2026-09-03 22:53:44 +08:00
24 lines
709 B
Python
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
|