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 align: str | None = None

Horizontal alignment (left/center/right), if given.

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.

field height: int | None = None

Target height; unset keeps the source image’s own.

field path: str [Required]

File path, resolved like any other file the config references.

field valign: str | None = None

Vertical alignment (top/middle/center/bottom), if given.

field width: int | None = None

Target width; unset keeps the source image’s own.

field x: int | None = None

Horizontal position, if given.

field y: int | None = None

Vertical position, if given.

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 align: str | None = None

Horizontal alignment (left/center/right), if given.

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.

field height: int | None = None

Target height; unset keeps the source image’s own.

field identifier: str [Required]

The comic’s slug from its GoComics URL, e.g. calvinandhobbes.

field valign: str | None = None

Vertical alignment (top/middle/center/bottom), if given.

field width: int | None = None

Target width; unset keeps the source image’s own.

field x: int | None = None

Horizontal position, if given.

field y: int | None = None

Vertical position, if given.

<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 align: str | None = None

Horizontal alignment (left/center/right), if given.

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.

field height: int | None = None

Target height; unset keeps the source image’s own.

field icon: str [Required]

The icon id, e.g. “01d” - see WeatherIcon.id() for how it’s built.

field theme: str = 'openweather'

Which bundled icon set to use: openweather or erikflower.

field valign: str | None = None

Vertical alignment (top/middle/center/bottom), if given.

field width: int | None = None

Target width; unset keeps the source image’s own.

field x: int | None = None

Horizontal position, if given.

field y: int | None = None

Vertical position, if given.

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.