Skip to content

Commit

Permalink
Update comments
Browse files Browse the repository at this point in the history
  • Loading branch information
keller-mark committed Aug 2, 2024
1 parent 7176dc9 commit 5e61704
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 4 deletions.
15 changes: 12 additions & 3 deletions vitessce/widget.py
Original file line number Diff line number Diff line change
Expand Up @@ -393,14 +393,23 @@ def get_uid_str(uid):
export default { createPlugins };
"""

# Abstract class for widget plugins to subclass


class VitesscePlugin:
"""
A class that represents a Vitessce widget plugin. Custom plugins can be created by subclassing this class.
"""
plugin_esm = DEFAULT_PLUGIN_ESM
commands = {}

def on_config_change(self, new_config):
"""
Config change handler.
:param dict new_config: The new config object.
:returns: config (likely with new "uid" property) or None
:rtype: dict or None
"""
raise NotImplementedError("on_config_change may optionally be implemented by subclasses.")


Expand Down Expand Up @@ -444,7 +453,7 @@ def __init__(self, config, height=600, theme='auto', uid=None, port=None, proxy=
:param str js_package_version: The version of the NPM package ('vitessce' if not js_dev_mode else '@vitessce/dev').
:param bool js_dev_mode: Should @vitessce/dev be used (typically for debugging purposes)? By default, False.
:param str custom_js_url: A URL to a JavaScript file to use (instead of 'vitessce' or '@vitessce/dev' NPM package).
:param list[WidgetPlugin] plugins: A list of subclasses of WidgetPlugin, defining plugin_esm (string) and/or on_config_change (function). Optional.
:param list[WidgetPlugin] plugins: A list of subclasses of VitesscePlugin. Optional.
:param bool remount_on_uid_change: Passed to the remountOnUidChange prop of the <Vitessce/> React component. By default, True.
.. code-block:: python
Expand Down
2 changes: 1 addition & 1 deletion vitessce/widget_plugins/spatial_query.py
Original file line number Diff line number Diff line change
Expand Up @@ -138,7 +138,7 @@ def __init__(self, adata, spatial_key="X_spatial", label_key="cell_type"):
plugin = SpatialQueryPlugin(adata, spatial_key="X_spatial", label_key="cell_type")
# ...
vc.widget(plugins=[plugin])
vc.widget(plugins=[plugin], remount_on_uid_change=False)
"""
from SpatialQuery.spatial_query import spatial_query
import matplotlib.pyplot as plt # Add as dependency / optional dependency?
Expand Down

0 comments on commit 5e61704

Please sign in to comment.