Karana.KUtils.MultibodyWebUI
============================

.. py:module:: Karana.KUtils.MultibodyWebUI

.. autoapi-nested-parse::

   A GUI used to inspect a Multibody.



Classes
-------

.. autoapisummary::

   Karana.KUtils.MultibodyWebUI.MultibodyWebUI
   Karana.KUtils.MultibodyWebUI.AbstractPane
   Karana.KUtils.MultibodyWebUI.Context


Package Contents
----------------

.. py:class:: MultibodyWebUI(mbody: Karana.Dynamics.Multibody, *, port: int = 29534, stick_parts: Literal['auto', 'always', 'never'] = 'auto', stick_parts_config: Optional[Karana.Dynamics.StickPartsConfig] = 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)

   MultibodyWebUI class.

   This class creates a Multibody-centric web-based GUI



   .. py:attribute:: sim
      :value: None



   .. py:attribute:: cleanups


   .. py:attribute:: server


   .. py:attribute:: router


   .. py:attribute:: selection
      :type:  Karana.WebUI.State


   .. py:attribute:: hovered
      :type:  Karana.WebUI.State


   .. py:attribute:: webscene_selection_mode
      :value: 'Body'



   .. py:attribute:: scene
      :type:  Karana.Scene.ProxyScene


   .. py:attribute:: graphics
      :type:  Karana.Scene.WebScene


   .. py:attribute:: graphics_frame


   .. py:attribute:: effects


   .. py:attribute:: visjs_label_map
      :value: None



   .. py:attribute:: visjs_server
      :type:  Karana.KUtils.visjs.MultibodyGraphServer


   .. py:attribute:: visjs_frame


   .. py:attribute:: visjs_servers
      :type:  dict[int, tuple[Karana.KUtils.visjs.MultibodyGraphServer, bool]]


   .. py:attribute:: mbody_tree_view


   .. py:attribute:: all_tree_view


   .. py:attribute:: wmain


   .. py:attribute:: treeviews_options
      :value: ['Frames']



   .. py:attribute:: wtreeviews


   .. py:attribute:: wwebscene_selection_mode


   .. py:attribute:: wdeselect


   .. py:attribute:: wreset_viz


   .. py:attribute:: wtoolbar


   .. py:attribute:: dock


   .. py:attribute:: info_panel


   .. py:method:: setAxesGlobalScale(part: float, line: float | None = None)

      Set the global scaling factor for axes.



   .. py:method:: deselect()

      Make it so nothing is selected.



   .. py:method:: treeviews(selected_label)

      Create the selected TreeView.



   .. py:method:: updateInfoPanel(raw: Karana.WebUI.Json, info_panel: Karana.KUtils.MultibodyWebUI._infopanel.InfoPanel)

      Update the specified info panel based on selection change.



   .. py:method:: close()

      Idempotently close the GUI and cleanup created objects.



   .. py:method:: __del__()

      Idempotently close the GUI and cleanup created objects.



.. py:class:: AbstractPane(context: Context)

   Bases: :py:obj:`abc.ABC`, :py:obj:`WrappedTypeMixin`\ [\ :py:obj:`T`\ ]


   Interface for an info pane for a given item type.


   .. py:property:: item
      :type: T


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


   .. py:method:: getItem() -> T | None

      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.




   .. py:property:: context
      :type: Context



   .. py:property:: label
      :type: str

      :abstractmethod:


      Get a text label for this pane.


   .. py:property:: wroot
      :type: Karana.WebUI.Widget

      :abstractmethod:


      Get the root widget for this pane.


   .. py:method:: teardown(_: T, /)

      Do any necessary cleanup when leaving the given item.

      Panes MAY override this if any cleanup is needed.




   .. py:method:: setup(item: T, item_context: Karana.WebUI.Json, /)
      :abstractmethod:


      Setup the pane for the new item.



   .. py:method:: updateFor(item: T, item_context: Karana.WebUI.Json, /)

      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.




   .. py:method:: close()

      Do any necessary cleanup.



   .. py:method:: isCompatible(item: Any) -> bool

      Check whether the Pane knows how to display an item.



.. py:class:: Context

   .. py:attribute:: dock
      :type:  Karana.WebUI.Dock


   .. py:attribute:: router
      :type:  Karana.WebUI.Router


   .. py:attribute:: selection
      :type:  Karana.WebUI.State


   .. py:attribute:: multibody
      :type:  Karana.Dynamics.Multibody


   .. py:attribute:: scene
      :type:  Karana.Scene.ProxyScene


   .. py:attribute:: graphics
      :type:  Karana.Scene.WebScene


   .. py:attribute:: effects
      :type:  Karana.KUtils.MultibodyWebUI._effects.EffectManager


   .. py:attribute:: mbody_tree_view
      :type:  Karana.WebUI.TreeView


   .. py:attribute:: setup_visjs
      :type:  Callable


   .. py:attribute:: setup_info_panel
      :type:  Callable


   .. py:attribute:: visjs_servers
      :type:  dict[int, tuple[Karana.KUtils.visjs.MultibodyGraphServer, bool]]


   .. py:attribute:: visjs_frame
      :type:  Karana.WebUI.IFrame


   .. py:attribute:: graphics_frame
      :type:  Karana.WebUI.IFrame


