wijjit.elements.display.status_indicator.StatusIndicator
- class wijjit.elements.display.status_indicator.StatusIndicator(id=None, classes=None, status='info', label=None, custom_statuses=None, indicator_style='filled')[source]
Status indicator element displaying colored dot with label.
A status indicator shows a colored circle/dot with an optional label to represent various states like success, error, warning, etc. Supports preset statuses and custom user-defined statuses.
- Parameters:
id (
str, optional) – Element identifierstatus (
str, optional) – Status name matching preset or custom status (default: “info”)label (
str, optional) – Optional label displayed after indicatorcustom_statuses (
dict, optional) – Custom status definitions mapping name to color string or (color, indicator_char) tupleindicator_style (
{"filled", "hollow", "square", "ascii"}, optional) – Indicator character style (default: “filled”)
- Variables:
Notes
This is a display-only element and is not focusable.
Default statuses: - error: red - warning: yellow - success: green - disabled: gray - info: blue - pending: cyan - active: bright_green - inactive: dim
Custom statuses can be registered via: - Constructor: custom_statuses={“custom”: “magenta”} - Runtime: indicator.register_status(“custom”, “magenta”)
- __init__(id=None, classes=None, status='info', label=None, custom_statuses=None, indicator_style='filled')[source]
Methods
__init__([id, classes, status, label, ...])add_class(class_name)Add a CSS class to this element.
apply_props(props)Apply props from a VNode, skipping ephemeral props.
get_ephemeral_state()Get ephemeral state that should survive reconciliation.
get_hardware_cursor_position()Absolute screen cell where the hardware terminal cursor should park.
get_height_for_width(width)Return the height this element needs when laid out at
width.Get the intrinsic (preferred) size of the status indicator.
handle_key(key)Handle a key press.
handle_mouse(event)Handle a mouse event.
has_class(class_name)Check if element has a CSS class.
on_blur()Called when element loses focus.
on_focus()Called when element gains focus.
on_hover_enter()Called when mouse enters element.
on_hover_exit()Called when mouse exits element.
on_mount()Called when element is first added to the element tree.
on_unmount()Called when element is removed from the element tree.
on_update(changed_props)Called when element props are updated during reconciliation.
register_status(name, color[, indicator])Register a custom status at runtime.
remove_class(class_name)Remove a CSS class from this element.
Paint memo for the skip-unchanged fast path.
render_to(ctx)Render status indicator to paint context.
restore_ephemeral_state(state)Restore ephemeral state after reconciliation.
set_bounds(bounds)Set the element's screen bounds.
toggle_class(class_name)Toggle a CSS class on this element.
Attributes
captures_tabWhether this element wants the Tab key instead of focus movement.
parent_frameGet the parent Frame if this element is inside a scrollable frame.
Get current status.
supports_dynamic_sizingWhether this element supports dynamic sizing.
- render_signature()[source]
Paint memo for the skip-unchanged fast path.
Captures the current status, indicator style, label, and the runtime status registry (which drives the indicator color and character), plus the style-affecting state. See
wijjit.elements.base.Element.render_signature().- Return type:
- render_to(ctx)[source]
Render status indicator to paint context.
- Parameters:
ctx (
PaintContext) – Paint context with buffer, style resolver, and boundsstyles (Theme)
classes (This element uses the following theme style)
status_indicator (-)
'status_indicator.{status}' (-)
status_indicator.label (-)
- Return type:
None