Karana.KUtils.MultibodyTUI.mbody#

MultibodyTUI class and state.

Attributes#

Classes#

State

Full state of the MultibodyTUI.

MultibodyTUI

A terminal user interface (TUI) to examine a multibody.

Functions#

choiceDisplayStr(→ str)

Construct a string indicating the selected choice from a list.

Module Contents#

Karana.KUtils.MultibodyTUI.mbody.VizMode#
Karana.KUtils.MultibodyTUI.mbody.VizModeCycler#
Karana.KUtils.MultibodyTUI.mbody.choiceDisplayStr(choice: Any, choices: list[Any]) str[source]#

Construct a string indicating the selected choice from a list.

Parameters:
  • choice (Any) – The currently selected choice

  • choices (list[Any]) – A list of candidate choices

Returns:

A string listing choices, emphasizing any that equal choice

Return type:

str

Karana.KUtils.MultibodyTUI.mbody.ViewTag#
class Karana.KUtils.MultibodyTUI.mbody.State[source]#

Full state of the MultibodyTUI.

The TUI generally works by copying this state and pushing a modified copy to the StateHistory stack. Separately the TUI can redraw its terminal output and update the graphics window based on the current State instance.

body_view: Karana.KUtils.MultibodyTUI.view.View[Karana.Dynamics.PhysicalBody]#
frame_view: Karana.KUtils.MultibodyTUI.view.View[Karana.Frame.Frame]#
loop_constraint_view: Karana.KUtils.MultibodyTUI.view.View[Karana.Dynamics.LoopConstraintBase]#
viz_mask: int#
viz: VizModeCycler#
view_tag: ViewTag = 'body'#
show_frame_axes: bool = True#
swing_config: Karana.KUtils.MultibodyTUI.swing.SwingConfig#
property view#

The current view.

replaceView(view: Karana.KUtils.MultibodyTUI.view.View)[source]#

Copy the full state replacing the current view.

Parameters:

view (View) – The new view to replace the current view

Returns:

A copy of the full state with the current view replaced

Return type:

State

class Karana.KUtils.MultibodyTUI.mbody.MultibodyTUI(multibody, *, run: bool = True, highlight: Karana.Scene.Scene_types.MaterialType | Karana.Scene.Color = Color.YELLOW, axes_size: float = 10)[source]#

Bases: Karana.KUtils.MultibodyTUI.base.TUIBase

A terminal user interface (TUI) to examine a multibody.

multibody#
graph_adapters: collections.abc.Mapping[ViewTag, GraphAdapter]#
loopdb#
hist#
notify#
highlighter#
highlighter2#
loop_lines#
frame_lines#
frame_axes#
swing_manager#
property state: State#

The current state.

redraw()[source]#

Redraw the MultibodyTUI view.

handleKey(key: str) bool[source]#

Handle a single key press from the user.