wijjit.core.render_context.RenderContext
- class wijjit.core.render_context.RenderContext(layout_context, template_context, focused_id=None, radiogroup_stack=<factory>, menu_stack=<factory>, item_stack=<factory>, frame_counter=0, overlays=<factory>, statusbar=None)[source]
Consolidated rendering context for template processing.
This class holds all state needed during template rendering, replacing the scattered _wijjit_* globals that were stored in Jinja2’s environment.
- Parameters:
- Variables:
layout_context (
LayoutContext) – Layout tree building contexttemplate_context (
dict) – Template variables (contains ‘state’, etc.)focused_id (
strorNone) – ID of the currently focused elementradiogroup_stack (
listofstr) – Stack of active radio group names (for nesting)menu_stack (
listoflistofMenuItem) – Stack of menu item lists being builtitem_stack (
listoflist) – Stack of generic item lists being collected by container tagsframe_counter (
int) – Counter for auto-generating frame IDsoverlays (
list) – List of overlay info dicts for dialogs/menusstatusbar (
ElementorNone) – StatusBar element if present
- __init__(layout_context, template_context, focused_id=None, radiogroup_stack=<factory>, menu_stack=<factory>, item_stack=<factory>, frame_counter=0, overlays=<factory>, statusbar=None)
Methods
__init__(layout_context, template_context[, ...])add_overlay(overlay_info)Add an overlay info dict.
Generate a unique frame ID.
Pop and return the current generic item list.
pop_menu()Pop and return the current menu items list.
Pop and return the current radio group name.
Push a new generic item list onto the item stack.
Push a new menu items list onto the stack.
push_radiogroup(name)Push a radio group name onto the stack.
Attributes
Get the current generic item list without popping.
Get the current menu items list without popping.
Get the current radio group name without popping.
Get the application state dict from template context.
- layout_context: LayoutContext
- statusbar: Any = None
- property state: dict[str, Any]
Get the application state dict from template context.
- Returns:
Application state, or empty dict if not present
- Return type:
- generate_frame_id()[source]
Generate a unique frame ID.
- Returns:
Generated ID like ‘frame_1’
- Return type:
- push_radiogroup(name)[source]
Push a radio group name onto the stack.
- Parameters:
name (
str) – Radio group name- Return type:
None
Push a new menu items list onto the stack.
- Returns:
The new menu items list (to be populated by menuitem tags)
- Return type:
Pop and return the current menu items list.
Get the current menu items list without popping.
- push_items()[source]
Push a new generic item list onto the item stack.
Used by list-like elements (select, tree) to collect items declared via nested child tags (
selectitem/treeitem). Tree nesting pushes an additional list per level for child items.- Returns:
The new item list (to be populated by child item tags).
- Return type: