Image widgets: <image>, <gocomics>, <weather.icon>
All three of these load a bitmap and optionally resize it into a bounding box; they only differ in
where the bitmap comes from. In the Python source (see Python API reference), they share a common base,
ImageBaseView (todays_paper_web/widgets/core/image.py) — not registered as a tag itself, just the
shared resize/fit logic — and each implements its own fetch_img() on top. The sizing/fitting attributes
(width, height, fillmode) are shared the same way, via a common ImageParams model every concrete
widget’s own Params inherits, and work identically everywhere they appear below.
If resizing fails to produce a target size (e.g. fillmode misspelled), a warning is logged and the
original image is returned unresized rather than the render failing — unlike an unrecognized color on
other widgets, an unrecognized fillmode doesn’t raise.
<image>
Loads an arbitrary image file from config storage.
<image x="0" y="0" width="300" height="200" path="home/cal_task.png" />
- pydantic model todays_paper_web.widgets.core.image.LocalImageParams[source]
Bases:
ImageParams- field fillmode: str = 'preserveaspectfit'
How the source image fills the width/height box: preserveaspectfit shrinks to fit within the box without enlarging; preserveaspectstretch scales to touch at least one edge of the box. Both preserve aspect ratio. An unrecognized value is logged and leaves the image unresized, rather than raising.
Any format Pillow can open. path is the one attribute specific to <image> — width/height/
fillmode above come from ImageParams, shared with <gocomics>/<weather.icon> below.
<gocomics>
Fetches today’s strip for a given GoComics title, fresh on every render (no
caching beyond whatever the Runner’s render schedule provides — see Designing screens).
<gocomics identifier="calvinandhobbes" width="800" />
- pydantic model todays_paper_web.widgets.misc.gocomics.GoComicsParams[source]
Bases:
ImageParams- field fillmode: str = 'preserveaspectfit'
How the source image fills the width/height box: preserveaspectfit shrinks to fit within the box without enlarging; preserveaspectstretch scales to touch at least one edge of the box. Both preserve aspect ratio. An unrecognized value is logged and leaves the image unresized, rather than raising.
<weather.icon>
Renders a weather condition icon. Meant to be used with the id produced by a weather.yr-sourced
forecast’s icon.id() — see weather.yr for how that id is built and what values it
can take.
<weather.icon icon="{{ forecast.icon.id() }}" theme="erikflower" width="80" height="80" />
- pydantic model todays_paper_web.widgets.weather.core.WeatherIconParams[source]
Bases:
ImageParams- field fillmode: str = 'preserveaspectfit'
How the source image fills the width/height box: preserveaspectfit shrinks to fit within the box without enlarging; preserveaspectstretch scales to touch at least one edge of the box. Both preserve aspect ratio. An unrecognized value is logged and leaves the image unresized, rather than raising.
If the requested icon/theme combination doesn’t exist as a file, nothing is rendered for that tag
(no error) — check todays_paper_web/widgets/weather/img/<theme>/ for the available filenames if an
icon silently doesn’t show up.