modern_urwid.widgets.builder

Classes

WidgetBuilder(node, context)

Used to create urwid widgets from the AST nodes.

class modern_urwid.widgets.builder.WidgetBuilder(node: LayoutNode | None, context: CompileContext)

Bases: object

Used to create urwid widgets from the AST nodes. Subclasses should define the following methods: - build - attach_children (if the widget has children) - after_build (if extra modification is needed)

The following attributes can be used if applicable: - node: LayoutNode - context: CompileContext

after_build(widget: AttrMap) Widget

Optional hook to wrap or modify the widget after creation. Useful for containers, decorators, or instrumentation.

attach_children(widget: Widget, children: list[tuple[Widget, SizeOptions, Metadata]])
build(*args, **kwargs) Widget

Build and return the widget.

resolve_resource(unresolved: UnresolvedResource)

Resolve a module attribute.

resolve_template(unresolved: UnresolvedTemplate)

Resolve a string template.

tag: str | None = None