nanome.api.plugin_instance module¶
-
class
AsyncPluginInstance[source]¶ Bases:
nanome.api.plugin_instance.PluginInstanceBase class of any asynchronous plugin.Constructor should never be called by the user as it is network-instantiated when a session connects.All methods available to PluginInstance are available to AsyncPluginInstance.Decorating these methods with @async_callback will allow them to use the async keyword in their definition-
is_async= True¶
-
-
class
PluginInstance[source]¶ Bases:
objectBase class of any plugin.Constructor should never be called by the user as it is network-instantiated when a session connects.Start, update, and all methods starting by “on” can be overridden by user, in order to get requests results-
add_bonds(complex_list, callback=None, fast_mode=None)[source]¶ - Calculate bondsRequires openbabel to be installed
Parameters:
-
add_dssp(complex_list, callback=None)[source]¶ - Use DSSP to calculate secondary structures
Parameters:
-
add_to_workspace(complex_list, callback=None)[source]¶ - Add a list of complexes to the current workspace
Parameters: - complex_list (list of
Complex) – List of Complexes to add - callback (Callable[[], None]) – Callback when request is done.
- complex_list (list of
-
apply_color_scheme(color_scheme, target, only_carbons)[source]¶ Applies a color scheme to selected atoms.
Parameters: - color_scheme (
ColorScheme) – the color scheme to use on atoms - target (
ColorSchemeTarget) – whether you want to color the atom, the surface, or the ribbon - only_carbons (bool) – whether you want to only color carbons, or all atoms.
- color_scheme (
-
center_on_structures(structures, callback=None)[source]¶ - Repositions the workspace such that the provided structure(s) will be in thecenter of the world.
Parameters: - structures (list of
Base) – Molecular structure(s) to update. - callback (Callable[[], None]) – Callback when center is done.
- structures (list of
-
create_reading_stream(indices_list, stream_type, callback=None)[source]¶ - Create a stream allowing the plugin to continuously receive properties of many objects
Parameters: - indices_list (list of
int) – List of indices of all objects that should be in the stream - stream_type (list of
Type) – Type of stream to create - callback (Callable[[Stream, StreamCreationError], None]) – Callback to receive the created stream.
- indices_list (list of
-
create_writing_stream(indices_list, stream_type, callback=None)[source]¶ - Create a stream allowing the plugin to continuously update properties of many objects
Parameters: - indices_list (list of
int) – List of indices of all objects that should be in the stream - stream_type (list of
Type) – Type of stream to create - callback (Callable[[Stream, StreamCreationError], None]) – Callback to receive the created stream.
- indices_list (list of
-
custom_data¶ - Get custom data set with Plugin.set_custom_data
Type: tuple of objects or None if no data has been set
-
is_async= False¶
-
on_complex_list_changed()[source]¶ - Called whenever a complex is added or removed from the workspace.
-
open_url(url, desktop_browser=False)[source]¶ - Opens a URL alongside the Nanome session in the default web browser.
Parameters:
-
plugin_files_path¶
-
remove_from_workspace(complex_list, callback=None)[source]¶ - Remove a list of complexes from the current workspace
Parameters: - complex_list (list of
Complex) – List of Complexes to remove - callback (Callable[[], None]) – Callback when request is done.
- complex_list (list of
-
request_complex_list(callback=None)[source]¶ - Request the list of all complexes in the workspace, in shallow mode.
Parameters: callback (Callable[[List[Complex]], None]) – Callback to receive list of complexes.
-
request_complexes(id_list, callback=None)[source]¶ - Requests a list of complexes by their indicesComplexes returned contains the full structure (atom/bond/residue/chain/molecule)
Parameters:
-
request_controller_transforms(callback=None)[source]¶ - Requests presenter controller info (head position, head rotation, left controller position, left controller rotation, right controller position, right controller rotation)
Parameters: callback (Callable[[Vector3, Quaternion, Vector3, Quaternion, Vector3, Quaternion], None]) – Callback to receive the presenter controller info.
-
request_directory(path, callback=None, pattern='*')[source]¶ - Requests the content of a directory on the machine running Nanome
Parameters:
-
request_export(format, callback=None, entities=None)[source]¶ Request a file export using Nanome exporters Can request either molecule or workspace export, for entities in Nanome workspace or directly sent by the plugin (without begin uploaded to workspace)
Parameters: - format (
ExportFormats) – File format to export - entities (list of or unique object of type
WorkspaceorComplex, or None, or list of or uniqueint) – Entities to export (complexes to send, or indices if referencing complexes in workspace, or a workspace, or nothing if exporting Nanome workspace) - callback (Callable[[Union[str, bytes]], None]) – Callback when file is exported.
- format (
-
request_files(file_list, callback=None)[source]¶ - Reads files on the machine running Nanome, and returns them
Parameters: file_list (list of str) – List of file name (with path) to read. E.g. [“a.sdf”, “../b.sdf”] will read a.sdf in running directory, b.sdf in parent directory, and return them
- Requests spatial information of the plugin menu (position, rotation, scale)
Parameters: - index (int) – Index of the menu you wish to read
- callback (Callable[[Vector3, Quaternion, Vector3], None]) – Callback to receive the menu’s position, rotation, and scale.
-
request_presenter_info(callback=None)[source]¶ - Requests presenter account info (unique ID, name, email)
Parameters: callback (Callable[[PresenterInfo], None]) – Callback to receive the presenter account info.
-
request_workspace(callback=None)[source]¶ - Request the entire workspace, in deep mode
Parameters: callback (Callable[[Workspace], None]) – Callback to receive workspace.
-
save_files(file_list, callback=None)[source]¶ - Save files on the machine running Nanome, and returns result
Parameters: - file_list (list of
FileSaveData) – List of files to save with their content - callback – Callback to receive save file results.
- file_list (list of
-
send_files_to_load(files_list, callback=None)[source]¶ - Send file(s) to Nanome to load directly using Nanome’s importers.Can send just a list of paths, or a list of tuples containing (path, name)
Parameters:
-
send_notification(type, message)[source]¶ - Send a notification to the user
Parameters: - type (
NotificationTypes) – Type of notification to send. - message (str) – Text to display to the user.
- type (
- Update the position, scale, and rotation of the menu
Parameters: - index (int) – Index of the menu you wish to update
- position (
vector3) – New position of the menu - rotation (
quaternion) – New rotation of the menu - scale (
vector3) – New scale of the menu
- Set text and/or usable state of the buttons on the plugin connection menu in Nanome
Parameters:
-
update_content(*content)[source]¶ - Update specific UI elements (button, slider, list…)
Parameters: content ( UIBaseor multipleUIBaseor a list ofUIBase) – UI elements to update
- Update the menu in Nanome
Parameters: - menu (
Menu) – Menu to update - shallow (bool) – Whether you want to update only the menu’s top level, or the whole tree.
- menu (
-
update_node(*nodes)[source]¶ - Updates layout nodes and their children
Parameters: nodes ( LayoutNodeor multipleLayoutNodeor a list ofLayoutNode) – Layout nodes to update
-
update_structures_deep(structures, callback=None)[source]¶ - Update the specific molecular structures in the scene to match the structures in parameter.Will also update descendent structures and can be used to remove descendent structures.
Parameters: - structures (list of
Base) – List of molecular structures to update. - callback (Callable[[], None]) – Callback when update is done.
- structures (list of
-
update_structures_shallow(structures)[source]¶ - Update the specific molecular structures in the scene to match the structures in parameterOnly updates the structure’s data, will not update children or other descendents.
Parameters: structures (list of Base) – List of molecular structures to update.
-
update_workspace(workspace)[source]¶ - Replace the current workspace in the scene by the workspace in parameter
Parameters: workspace ( Workspace) – New workspace
-
zoom_on_structures(structures, callback=None)[source]¶ - Repositions and resizes the workspace such that the provided structure(s) will be in thecenter of the users view.
Parameters: - structures (list of
Base) – Molecular structure(s) to update. - callback (Callable[[], None]) – Callback when zoom is done.
- structures (list of
-