Add experimental HTML/CSS "modern" render style for weather widget
The weather widget's icons/layout are hand-drawn PIL primitives -- clean under quantization but flat, no gradients/shadows. Adds an opt-in render_style="modern" (current/daily modes only) that instead renders a Jinja2 template through a persistent headless-Chromium browser (app/html_render.py), following the approach of Tesserae, an open-source e-ink dashboard targeting this same panel family. Key design points: - The Chromium dependency (Playwright) is lazily imported only when a weather widget actually uses "modern" style, and the background browser itself only launches on first use -- every other widget type, and this one's own classic/hourly/multi_city paths, never pay for it. - No Frame-level dithering setting needed: html_render dithers its own rendered widget to exact palette colors (Bayer/ordered, not Floyd-Steinberg) before compositing, so the shared whole-canvas Floyd-Steinberg pass sees zero quantization error there and leaves it untouched -- same trick draw_text/hand-drawn icons already use. Floyd- Steinberg keeps working unchanged for photos and every other widget. - A "Load calibrated Spectra 6 preset" button in Advanced configuration offers a community-measured palette (data ported from paperlesspaper/epdoptimize, Apache 2.0) as an alternative starting point to the existing idealized DEFAULT_PALETTE_RGB -- fills the existing palette table, doesn't save by itself. Known open risk, not resolved here: a headless Chromium binary is far larger than the ~100MB single-layer limit that already forced this project's pip/npm installs into split layers, and (unlike those) is a single ~180MB file that can't be split across layers by ordinary Dockerfile restructuring. Flagged prominently in server/Dockerfile and docs/widgets.md -- treat this render style as experimental/local-only until that's resolved.
This commit is contained in:
@@ -269,6 +269,25 @@ modes (`WeatherWidgetConfig.mode`, switchable in the widget's dialog like
|
||||
side -- the calendar widget's embedded strip, as a standalone
|
||||
widget's whole content instead of a strip above an agenda day.
|
||||
|
||||
**Render style** (`WeatherWidgetConfig.render_style`, `"classic"` default
|
||||
| `"modern"`, experimental): `current`/`daily` only -- `hourly`/
|
||||
`multi_city` always render classic regardless of this setting. `modern`
|
||||
draws the widget as an HTML/CSS card (Jinja2 templates under
|
||||
`app/templates/widget_html/`) through a persistent headless Chromium
|
||||
browser (`app/html_render.py`, Playwright) instead of `app/weather_render.
|
||||
py`'s hand-drawn PIL primitives -- gradients/shadows/soft icon shading
|
||||
PIL can't easily do. Its own `ordered_dither` (Bayer/ordered, not Floyd-
|
||||
Steinberg) commits the rendered widget to exact palette colors *before*
|
||||
compositing, so it's safe to mix with photo/other classic-rendered
|
||||
widgets on the same frame without a Floyd-Steinberg seam at the boundary
|
||||
(see that module's docstring for why ordered dithering doesn't have this
|
||||
problem and Floyd-Steinberg does) -- no `Frame`-level dithering setting
|
||||
was needed. Playwright/Chromium is a real, heavyweight runtime dependency
|
||||
imported lazily only when a weather widget actually uses this style, and
|
||||
its Docker packaging has a known likely-blocking image-size problem not
|
||||
yet resolved (see `server/Dockerfile`'s own comment) -- treat this style
|
||||
as unshipped/local-only until that's sorted out.
|
||||
|
||||
`current`/`hourly`/`daily` share one configured location
|
||||
(`city_label`/`city_latitude`/`city_longitude`, set via `POST .../
|
||||
weather-location`, geocoded through `weather.geocode_city`); `multi_city`
|
||||
|
||||
Reference in New Issue
Block a user