Karana.KUtils.MultibodyWebUI#

A GUI used to inspect a Multibody.

Classes#

MultibodyWebUI

MultibodyWebUI class.

AbstractPane

Interface for an info pane for a given item type.

Context

Package Contents#

class Karana.KUtils.MultibodyWebUI.MultibodyWebUI(mbody: Karana.Dynamics.Multibody, *, port: int = 29534, stick_parts: Literal['auto', 'always', 'never'] = 'auto', stick_parts_config: Karana.Dynamics.StickPartsConfig | None = None, graphics_origin_frame: Karana.Frame.Frame | None = None, name_to_label_map: dict[str, str] | None = None, sp: Karana.Dynamics.StatePropagator | None = None, sim: Sim | None = None, time_display_period: float | None = 0.01)[source]#

MultibodyWebUI class.

This class creates a Multibody-centric web-based GUI

sim = None#
cleanups#
server#
router#
selection: Karana.WebUI.State#
hovered: Karana.WebUI.State#
webscene_selection_mode = 'Body'#
scene: Karana.Scene.ProxyScene#
graphics: Karana.Scene.WebScene#
graphics_frame#
effects#
visjs_label_map = None#
visjs_server: Karana.KUtils.visjs.MultibodyGraphServer#
visjs_frame#
visjs_servers: dict[int, tuple[Karana.KUtils.visjs.MultibodyGraphServer, bool]]#
mbody_tree_view#
all_tree_view#
wmain#
treeviews_options = ['Frames']#
wtreeviews#
wwebscene_selection_mode#
wdeselect#
wreset_viz#
wtoolbar#
dock#
info_panel#
setAxesGlobalScale(part: float, line: float | None = None)[source]#

Set the global scaling factor for axes.

deselect()[source]#

Make it so nothing is selected.

treeviews(selected_label)[source]#

Create the selected TreeView.

updateInfoPanel(raw: Karana.WebUI.Json, info_panel: Karana.KUtils.MultibodyWebUI._infopanel.InfoPanel)[source]#

Update the specified info panel based on selection change.

close()[source]#

Idempotently close the GUI and cleanup created objects.

__del__()[source]#

Idempotently close the GUI and cleanup created objects.

class Karana.KUtils.MultibodyWebUI.AbstractPane(context: Context)[source]#

Bases: abc.ABC, WrappedTypeMixin[T]

Interface for an info pane for a given item type.

property item: T#

Get the current item or throw an error if it isn’t set.

getItem() T | None[source]#

Get the current item or None if it isn’t set.

If the item was previously set but has gone out of scope, throws an error.

property context: Context#
property label: str#
Abstractmethod:

Get a text label for this pane.

property wroot: Karana.WebUI.Widget#
Abstractmethod:

Get the root widget for this pane.

teardown(_: T, /)[source]#

Do any necessary cleanup when leaving the given item.

Panes MAY override this if any cleanup is needed.

abstract setup(item: T, item_context: Karana.WebUI.Json, /)[source]#

Setup the pane for the new item.

updateFor(item: T, item_context: Karana.WebUI.Json, /)[source]#

Set the item to display and refresh.

By default this will teardown the old item and setup the new one (which may be the same item when refreshing). Panes MAY override this method to make optimizations.

close()[source]#

Do any necessary cleanup.

isCompatible(item: Any) bool[source]#

Check whether the Pane knows how to display an item.

class Karana.KUtils.MultibodyWebUI.Context[source]#
dock: Karana.WebUI.Dock#
router: Karana.WebUI.Router#
selection: Karana.WebUI.State#
multibody: Karana.Dynamics.Multibody#
scene: Karana.Scene.ProxyScene#
graphics: Karana.Scene.WebScene#
effects: Karana.KUtils.MultibodyWebUI._effects.EffectManager#
mbody_tree_view: Karana.WebUI.TreeView#
setup_visjs: Callable#
setup_info_panel: Callable#
visjs_servers: dict[int, tuple[Karana.KUtils.visjs.MultibodyGraphServer, bool]]#
visjs_frame: Karana.WebUI.IFrame#
graphics_frame: Karana.WebUI.IFrame#