Replay widget

Requires the replay extra (pip install "longeron[replay]").

The timeline recorders this widget animates live in longeron.replay.

The replay widget: animate a recorded Timeline over its baked diagram.

replay_widget() simulates an element (or takes a prebuilt Timeline), bakes the matching diagram to SVG (longeron.render), and animates the run over it in the notebook front-end (anywidget, optional – install with pip install "longeron[replay]"): active states light up green, fired transitions pulse orange, with play/pause, speed, and scrubbing controls, plus a scalar-env readout that follows the playhead. Pure event cascades (no clock advance) replay in step mode, scrubbing over the step index instead of sim time.

The timeline recorders themselves (record_timeline(), record_action_timeline()) live in longeron.replay: recording is simulation, not presentation, and needs no widget toolkit.

longeron.widgets.replay.ReplayKind

which view and recorder replay_widget() uses: the state diagram with record_timeline(), or the action diagram with record_action_timeline()

alias of Literal[‘state’, ‘action’]

longeron.widgets.replay.replay_widget(interpreter, element, events=None, *, inputs=None, width_px=760, kind=None, timeline=None)[source]

Simulate element and replay it over its diagram.

kind picks the view and recorder: "state" (record_timeline() over the state diagram) or "action" (record_action_timeline() over the action diagram). The default (None) auto-detects: elements whose kind is "action" replay as actions, everything else as a state machine.

timeline skips the recording and replays a PREBUILT Timeline instead, so one recording can feed this widget, the mission globe, and the time seam’s scrubber (see longeron.widgets.time); it excludes events/inputs. The widget’s bidirectional time trait is its seam surface: a kernel-side write seeks the playhead (stopping any front-end playback first), and the front-end reports the playhead at ~4 Hz while playing – longeron.widgets.link_time() subscribes it to a shared clock.

Needs the replay extra (anywidget) plus the diagram toolchain (vendored ipyelk and a node executable, as for render.to_svg).

Return type:

AnyWidget