feat: weather view and preview script
Co-Authored-By: Claude Sonnet 5.5 <[email protected]>
This commit is contained in:
1 parent
37065a5fba
commit
65843aa958
5 files changed
+392
No files matched your search
@@ -0,0 +1,31 @@
|
||||
"""What a screen view looks like to the runner."""
|
||||
from dataclasses import dataclass
|
||||
from datetime import datetime
|
||||
from typing import Hashable, Protocol
|
||||
|
||||
from PIL import Image
|
||||
|
||||
|
||||
@dataclass
|
||||
class Patch:
|
||||
"""A partial update: draw `image` with its top-left corner at (x, y)."""
|
||||
image: Image.Image
|
||||
x: int
|
||||
y: int
|
||||
|
||||
|
||||
class View(Protocol):
|
||||
name: str
|
||||
|
||||
def start(self) -> None: ...
|
||||
|
||||
def stop(self) -> None: ...
|
||||
|
||||
def frame_key(self, now: datetime) -> Hashable:
|
||||
"""Changes whenever a full redraw is needed."""
|
||||
|
||||
def render(self, now: datetime) -> Image.Image:
|
||||
"""The full 480x320 frame."""
|
||||
|
||||
def patch(self, now: datetime) -> Patch | None:
|
||||
"""Cheap partial update valid while frame_key is unchanged (e.g. the seconds)."""
|
||||
Reference in new issue
Block a user