Karana.KUtils.MultibodyWebUI

Contents

Karana.KUtils.MultibodyWebUI#

A GUI used to inspect a Multibody.

Classes#

MultibodyWebUI

MultibodyWebUI class.

AbstractCard

Interface for an info card for a given item type.

GuiContext

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[int | 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#
worker#
server#
router#
error_count = 0#
notifier#
selection: Karana.WebUI.State#
hovered: Karana.WebUI.State#
webscene_selection_mode = 'Body'#
scene: Karana.Scene.ProxyScene#
graphics: Karana.Scene.WebScene#
graphics_frame#
effects#
visjs_frames_server: Karana.KUtils.visjs.GraphServer#
visjs_frames_iframe#
visjs_label_map = None#
visjs_server: Karana.KUtils.visjs.MultibodyGraphServer#
visjs_iframe#
visjs_servers: dict[int, tuple[Karana.KUtils.visjs.MultibodyGraphServer, bool]]#
mbody_tree_view#
subtrees_tree_view#
wmain#
treeviews_options = []#
wtreeviews#
wwebscene_selection_mode#
webscene_view_mode = 'pers_free'#
wwebscene_view_mode#
wdeselect#
wreset_viz#

# slider to scale the stick parts slider_opts = kw.SliderOptions() slider_opts.min = 0.01 slider_opts.max = 1 slider_opts.step = 0.01

waxes_scale#
wcamera_physical#
wcamera_collision#
wcamera_stick#
wshadows#
wlayout_3d#
wscene#
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: str)[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.AbstractCard(context: GuiContext)[source]#

Bases: abc.ABC, WrappedTypeMixin[T]

Interface for an info card 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: GuiContext#
property label: str#
Abstractmethod:

Get a text label for this card.

property wroot: Karana.WebUI.Layout#

Get the root widget for this card.

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

Do any necessary cleanup when leaving the given item.

Cards MAY override this if any cleanup is needed.

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

Set up the card for the new item.

Derived Card classes SHOULD call this to update the header and summary.

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). Cards MAY override this method to make optimizations.

close()[source]#

Do any necessary cleanup.

isCompatible(item: Any) bool[source]#

Check whether the Card knows how to display an item.

getHeader() str[source]#

Get a single-line markdown header of the current item.

getSummary() str[source]#

Get a markdown summary of the current item.

class Karana.KUtils.MultibodyWebUI.GuiContext[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#
subtrees_tree_view: Karana.WebUI.TreeView#
setup_visjs: Callable#
setup_info_panel: Callable#
visjs_servers: dict[int, tuple[Karana.KUtils.visjs.MultibodyGraphServer, bool]]#
visjs_frames_server: Karana.KUtils.visjs.NetworkGraph#
setup_frames_visjs: Callable#
visjs_iframe: Karana.WebUI.IFrame#
graphics_frame: Karana.WebUI.IFrame#
signal_error: Callable#
worker: Karana.KUtils.MultibodyWebUI._worker.AsyncWorker#