Menu Factory

orion_notebook.graph.extensibility.menu_factory.add_custom_menu_item(source_type: type, transformation: orion_notebook.graph.extensibility.transform.Transform, **menu_item_params: dict)None

Adds a new extensibility option to the list of options associated with an specific Entity type. This new options will be then shown in the form of menu items.

Parameters
  • source_type (type) – type of Entity to which the new extensibility option will be added

  • transformation (Transform) – extensibility option that will be added to the Entity

  • menu_item_params (dict) – custom parameters needed by the extensibility option. The available parameters are: - title: Sets the name of the transformation in the new menu item - icon: Sets the icon that will appear on the left side of the title (if the icon is to be retrieved from the Orion icon library) - icon_url: Sets the icon that will appear on the left side of the title (if the icon is to be retrieved from an URL) In the case that ‘icon’ and ‘icon_url’ are both defined, the ‘url_icon’ will take preference.

Examples:

add_custom_menu_item(SourceNode, CustomTransformA, title=’With icon from icon library’, icon=’support’) add_custom_menu_item(SourceNode, CustomTransformB, title=’With icon from URL’, icon_url=’http://url.to.icon/icon.jpg’)) add_custom_menu_item(SourceNode, CustomTransformC, title=’With no icon’)

orion_notebook.graph.extensibility.menu_factory.callback_factory(extensibility_options_for_node: List[orion_notebook.graph.menu_items.MenuItem])Callable

Builds a lambda function that returns the list of extensibility options when invoked

Parameters

extensibility_options_for_node – list of extensibility options associated with an specific Entity type

Returns

a list with the new extensibility options

Return type

Callable

orion_notebook.graph.extensibility.menu_factory.create_extensibility_options_for_node(transformations_for_node: List[Tuple[orion_notebook.graph.extensibility.transform.Transform, Dict]])List[orion_notebook.graph.menu_items.MenuItem]

Creates a new menu item for each extensibility option associated with an Entity type.

Parameters

transformations_for_node (List[Tuple[Transform, Dict]]) – list of extensibility options associated with an specific Entity type

Returns

a list with the new extensibility options

Return type

List[MenuItem]

orion_notebook.graph.extensibility.menu_factory.load_extensibility_options()None

Loads the extensibility options into the associated Entity types so that these options can be accessed through the correspondent menu items

orion_notebook.graph.extensibility.menu_factory.load_extensibility_options_for_node(source_type: type, transformations_for_node: List[Tuple[orion_notebook.graph.extensibility.transform.Transform, Dict]])None

Sets the extensibility options associated with an Entity type as return value of the extensibility_options_for_node. When invoked through the context menu, this method returns the list of extensibility options assigned to the Entity type

Parameters
  • source_type (type) – type of Entity to which the extensibility options will be added

  • transformations_for_node (List[Tuple[Transform, Dict]]) – list of extensibility option associated with a specific type of Entity