Navidrome now-playing, clock, and weather for a Waveshare epd4in0e panel, with a local web UI and install/uninstall scripts for the Pi.
29 lines
902 B
Python
29 lines
902 B
Python
"""Display driver interface.
|
|
|
|
A driver only needs to do three things: get ready, put an image on the panel,
|
|
and go to sleep to save power. `EPD4in0eDisplay` talks to the real Waveshare
|
|
hardware; `MockDisplay` is a drop-in stand-in for developing off the Pi.
|
|
"""
|
|
|
|
from abc import ABC, abstractmethod
|
|
|
|
from PIL import Image
|
|
|
|
|
|
class Display(ABC):
|
|
resolution: tuple[int, int]
|
|
|
|
@abstractmethod
|
|
def init(self) -> None:
|
|
"""Prepare the panel for writing (called once at startup, and again
|
|
after every sleep since most EPDs need re-initializing)."""
|
|
|
|
@abstractmethod
|
|
def show(self, image: Image.Image) -> None:
|
|
"""Push a full-resolution image to the panel. This is always a full
|
|
refresh on this hardware -- there is no partial-refresh path."""
|
|
|
|
@abstractmethod
|
|
def sleep(self) -> None:
|
|
"""Put the panel into low-power mode between updates."""
|