Files
StarPilot/openpilot/starpilot/favorites/state.py
T
firestar5683 978105ad9b Project identity and attribution
Document StarPilot setup and third-party attribution. Keep cloud authentication scoped to the selected provider.

Co-authored-by: Daniel Koepping <elkoled@gmail.com>
Co-authored-by: Danny <dannyirwin31@yahoo.com>
Co-authored-by: firestarsdog <229254897+firestarsdog@users.noreply.github.com>
Co-authored-by: Adeeb Shihadeh <adeebshihadeh@gmail.com>
2026-10-14 19:56:17 -05:00

56 lines
1.2 KiB
Python

from collections.abc import Callable
from dataclasses import dataclass, field
@dataclass(frozen=True)
class FavoriteAction:
key: str
label: str
kind: str = "action"
state_label: str = "Press"
available: bool = False
reason: str = "Unavailable in this context"
token: str = ""
invoke: Callable[[], bool] | None = field(default=None, compare=False, repr=False)
section: str = "Actions"
invoke_value: Callable[[float], bool] | None = field(default=None, compare=False, repr=False)
@dataclass(frozen=True)
class FavoriteRequest:
index: int
key: str
revision: str
action_token: str
@dataclass(frozen=True)
class FavoriteSlot:
index: int
key: str | None = None
label: str = ""
enabled: bool = False
show_onroad: bool = False
kind: str = "action"
state_label: str = "Not assigned"
available: bool = False
reason: str = "Choose a control"
request: FavoriteRequest | None = None
value: float | None = None
@dataclass(frozen=True)
class FavoriteSnapshot:
slots: tuple[FavoriteSlot, ...]
options: tuple[FavoriteAction, ...]
revision: str
configurable: bool
valid: bool
@dataclass(frozen=True)
class FavoriteResult:
success: bool
message: str
state_label: str = ""