View

class todays_paper_web.widgets.view.View(params)[source]

Bases: object

Params

Every widget’s Params is a ViewParams subclass - there is no widget without one, even <column>, which has nothing to add on top of ViewParams itself. Overridden per subclass; never unset.

alias of ViewParams

property params: ViewParams

The parsed Params model for this widget.

property children: Iterator[View]
property element: Element
property innerText
getData()[source]
openFile(filename) BinaryIO[source]
render() Image[source]
property source
static get(name, source, params, storage, config) View[source]
static paste(target: Image, source: Image, position: tuple[int, int])[source]

ViewParams

Every widget’s Params base — see Python API reference for why it lives here rather than in params.py alongside Color/Number.

pydantic model todays_paper_web.widgets.view.ViewParams[source]

Bases: BaseModel

Base Params for every widget - unlike DataSource’s equivalent, this carries real fields: x/y/align/valign, read off any child by whichever container it’s placed in (box/row/column, see todays_paper_web.widgets.core.layout) to decide where to place it - not owned by the child, its parent interprets it. A few widgets (e.g. line) also happen to read their own x/y for unrelated, widget-specific reasons; that’s the same attribute doing double duty, not a coincidence. Every widget’s Params inherits this, even one with no attributes of its own to add (e.g. <column>’s).

The default for each field is None, not e.g. "left" for align: a container decides whether and how to apply its own default when a value wasn’t given, which needs to be able to tell “not given” apart from any real value, including a falsy one like x="0" - so this reports presence faithfully rather than pre-applying any one container’s default.

field align: str | None = None

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

field valign: str | None = None

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

field x: int | None = None

Horizontal position, if given.

field y: int | None = None

Vertical position, if given.