PluginTemplateMixin#
- class jdaviz.core.template_mixin.PluginTemplateMixin(*args, **kwargs)[source]#
Bases:
TemplateMixinThis base class can be inherited by all sidebar/tray plugins to expose common functionality.
Public constructor
Attributes Summary
A trait for unicode strings.
A trait for unicode strings.
A trait for unicode strings.
A trait for unicode strings.
A boolean (True, False) trait.
A boolean (True, False) trait.
A trait for unicode strings.
A boolean (True, False) trait.
A float trait.
A boolean (True, False) trait.
A boolean (True, False) trait.
A boolean (True, False) trait.
A boolean (True, False) trait.
A boolean (True, False) trait.
Methods Summary
Context manager to temporarily enable keep_active and enable live-previews and keypress events, even if the plugin UI is not opened.
close_in_tray([close_sidebar])Close the plugin in the sidebar/tray.
new()observe_traitlets_for_relevancy(...[, ...])observe_traitlets_for_relevancyenables the app to observe traitlets necessary to determine configuration relevance for the plugins that require it.open_in_tray([scroll_to])Open the plugin in the sidebar/tray (and open the sidebar if it is not already).
relevant_if_all_truthy([traitlets])Set relevance (via empty/non-empty string) if all traitlets are truthy.
relevant_if_any_truthy([traitlets])Set relevance (via empty/non-empty string) if any traitlet is truthy.
show([loc, title])Display the plugin UI.
vue_plugin_ping(ping_timestamp)Attributes Documentation
- disabled_msg#
A trait for unicode strings.
- docs_description#
A trait for unicode strings.
- docs_link#
A trait for unicode strings.
- irrelevant_msg#
A trait for unicode strings.
- is_active#
A boolean (True, False) trait.
- keep_active#
A boolean (True, False) trait.
- plugin_description#
- plugin_key#
A trait for unicode strings.
- plugin_opened#
A boolean (True, False) trait.
- previews_last_time#
A float trait.
- previews_temp_disabled#
A boolean (True, False) trait.
- scroll_to#
A boolean (True, False) trait.
- spinner#
A boolean (True, False) trait.
- supports_auto_update#
A boolean (True, False) trait.
- user_api#
- uses_active_status#
A boolean (True, False) trait.
Methods Documentation
- as_active()[source]#
Context manager to temporarily enable keep_active and enable live-previews and keypress events, even if the plugin UI is not opened.
- close_in_tray(close_sidebar=False)[source]#
Close the plugin in the sidebar/tray.
- Parameters:
- close_sidebarbool
Whether to also close the sidebar itself.
- observe_traitlets_for_relevancy(traitlets_to_observe, irrelevant_msg_callback=None)[source]#
observe_traitlets_for_relevancyenables the app to observe traitlets necessary to determine configuration relevance for the plugins that require it. It sets up the observe method and calls the private method_set_relevantwhich relies on either a user-providedirrelevant_msg_callbackmethod or defaults to therelevant_if_all_truthymethod.- Parameters:
- traitlets_to_observelist or tuple
A list of the traitlets to be observed.
- irrelevant_msg_callbackfunction or None
A function that takes a list of traitlets and returns a msg to be set as the
irrelevant_msgattribute.
- open_in_tray(scroll_to=True)[source]#
Open the plugin in the sidebar/tray (and open the sidebar if it is not already).
- Parameters:
- scroll_tobool, optional
Whether to immediately scroll to the plugin opened in the tray.
- relevant_if_all_truthy(traitlets=None)[source]#
Set relevance (via empty/non-empty string) if all traitlets are truthy.
- relevant_if_any_truthy(traitlets=None)[source]#
Set relevance (via empty/non-empty string) if any traitlet is truthy.
- show(loc='inline', title=None)[source]#
Display the plugin UI.
- Parameters:
- locstr
The display location determines where to present the plugin UI. Supported locations:
“inline”: Display the plugin inline in a notebook.
“sidecar”: Display the plugin in a separate JupyterLab window from the notebook, the location of which is decided by the ‘anchor.’ right is the default
Other anchors:
sidecar:right(The default, opens a tab to the right of display)sidecar:tab-before(Full-width tab before the current notebook)sidecar:tab-after(Full-width tab after the current notebook)sidecar:split-right(Split-tab in the same window right of the notebook)sidecar:split-left(Split-tab in the same window left of the notebook)sidecar:split-top(Split-tab in the same window above the notebook)sidecar:split-bottom(Split-tab in the same window below the notebook)
See jupyterlab-sidecar for the most up-to-date options.
“popout”: Display the plugin in a detached display. By default, a new window will open. Browser popup permissions required.
Other anchors:
popout:window(The default, opens Jdaviz in a new, detached popout)popout:tab(Opens Jdaviz in a new, detached tab in your browser)
- titlestr, optional
The title of the sidecar tab. Defaults to the name of the plugin.
NOTE: Only applicable to a “sidecar” display.
Notes
If “sidecar” is requested in the “classic” Jupyter notebook, the plugin will appear inline, as only JupyterLab has a mechanism to have multiple tabs.