Class IPyWidgetsViewManager

Hierarchy

  • ManagerBase
    • IPyWidgetsViewManager

Constructors

Properties

comm_target_name: "jupyter.widget" = "jupyter.widget"

The comm target name to register

el: any

Methods

  • Fetch all widgets states from the kernel using the control comm channel If this fails (control comm handler not implemented kernel side), it will fall back to _loadFromKernelModels.

    This is a utility function that can be used in subclasses.

    Returns Promise<void>

  • Old implementation of fetching widget models one by one using the request_state message on each comm.

    This is a utility function that can be used in subclasses.

    Returns Promise<void>

  • Parameters

    • options: RequiredSome<IModelOptions, "model_id">
    • Optional serialized_state: any

    Returns Promise<WidgetModel>

  • callback handlers specific to a view

    Parameters

    • Optional view: WidgetView

    Returns ICallbacks

  • Close all widgets and empty the widget state.

    Returns

    Promise that resolves when the widget state is cleared.

    Returns Promise<void>

  • Creates a promise for a view of a given model

    Notes

    The implementation must trigger the Lumino 'after-attach' and 'after-show' events when appropriate, which in turn will trigger the view's 'displayed' events.

    Make sure the view creation is not out of order with any state updates.

    Type Parameters

    • VT extends DOMWidgetView<VT> = DOMWidgetView

    Parameters

    • model: DOMWidgetModel
    • Optional options: any

    Returns Promise<VT>

  • Type Parameters

    • VT extends WidgetView<VT> = WidgetView

    Parameters

    • model: WidgetModel
    • Optional options: any

    Returns Promise<VT>

  • Disconnect the widget manager from the kernel, setting each model's comm as dead.

    Returns void

  • Filter serialized widget state to remove any ID's already present in manager.

    Returns

    A copy of the state, with its 'state' attribute filtered

    Parameters

    • serialized_state: any

    Returns any

  • Get a promise for a model by model id.

    Notes

    If the model is not found, the returned Promise object is rejected.

    If you would like to synchronously test if a model exists, use .has_model().

    Parameters

    • model_id: string

    Returns Promise<WidgetModel>

  • Asynchronously get the state of the widget manager.

    This includes all of the widget models, and follows the format given in the @jupyter-widgets/schema package.

    Returns

    Promise for a state dictionary

    Parameters

    • Optional options: IStateOptions

      The options for what state to return.

    Returns Promise<IManagerState>

  • Handle when a comm is opened.

    Parameters

    • comm: IClassicComm
    • msg: ICommOpenMsg<"iopub" | "shell">

    Returns Promise<WidgetModel>

  • Returns true if the given model is registered, otherwise false.

    Notes

    This is a synchronous way to check if a model is registered.

    Parameters

    • model_id: string

    Returns boolean

  • Parameters

    • source: string

    Returns string

  • Parameters

    • className: string
    • moduleName: string
    • moduleVersion: string

    Returns Promise<typeof WidgetModel>

  • Parameters

    • className: string
    • moduleName: string
    • moduleVersion: string

    Returns Promise<typeof WidgetView>

  • Create and return a promise for a new widget model

    Example

    widget_manager.new_model({
    model_name: 'IntSlider',
    model_module: '@jupyter-widgets/controls',
    model_module_version: '1.0.0',
    model_id: 'u-u-i-d'
    }).then((model) => { console.log('Create success!', model); },
    (err) => {console.error(err)});

    Parameters

    • options: IModelOptions

      the options for creating the model.

    • Optional serialized_state: any

      attribute values for the model.

    Returns Promise<WidgetModel>

  • Create a comm and new widget model.

    Parameters

    • options: IWidgetOptions

      same options as new_model but comm is not required and additional options are available.

    • Optional serialized_state: JSONObject

      serialized model attributes.

    Returns Promise<WidgetModel>

  • Parameters

    • model_id: string
    • modelPromise: Promise<WidgetModel>

    Returns void

  • Resolve a URL relative to the current notebook location.

    The default implementation just returns the original url.

    Parameters

    • url: string

    Returns Promise<string>

  • Modifies view options. Generally overloaded in custom widget manager implementations.

    Parameters

    • Optional options: any

    Returns any

  • Set the widget manager state.

    Parameters

    • state: IManagerState

      a Javascript object conforming to the application/vnd.jupyter.widget-state+json spec.

      Reconstructs all of the widget models in the state, merges that with the current manager state, and then attempts to redisplay the widgets in the state.

    Returns Promise<WidgetModel[]>

Generated using TypeDoc