custom_event

class virtualitics_sdk.elements.custom_event.AssetDownloadCustomEvent(title, asset, extension, mime_type=None, show_title=True, show_description=True)

Bases: CustomEvent

Creates a custom event that generates a download link to an Asset’s data/object. The download link will return the bytes of the object if it is an instance of bytes, a text file if it is an instance of str or the dill pickled bytes of the python object.

callback(flow_metadata)
Return type:

Union[str, dict]

final execute(flow_metadata)

Since this function executes the callback, we want to make it @final to prevent it from being modified in a subclass :type flow_metadata: :param flow_metadata: :rtype: Union[str, dict] :return:

class virtualitics_sdk.elements.custom_event.CustomEvent(title, description, show_title=True, show_description=True, position=CustomEventPosition.RIGHT, label='', placeholder='', **kwargs)

Bases: InputElement

Creates a custom event element that calls the passed in function using flow_metadata when clicked.

Parameters:
  • title (str) – The title of the custom event element.

  • description (str) – A description to go with this element on the page.

  • show_title (bool) – whether to show the title on the page when rendered, defaults to True.

  • show_description (bool) – whether to show the description to the page when rendered, defaults to True.

  • position (CustomEventPosition) – The position the event button should be placed, defaults to CustomEventPosition.RIGHT

  • label (str) – The label of the element, defaults to ‘’.

  • placeholder (str) – The placeholder of the element, defaults to ‘’.

abstract callback(flow_metadat)
Return type:

Union[str, dict]

execute(flow_metadata)

Since this function executes the callback, we want to make it @final to prevent it from being modified in a subclass :type flow_metadata: :param flow_metadata: :rtype: Union[str, dict] :return:

get_value()

This function does nothing for Custom Events. Although they are input elements, getting their value will return None

Returns:

None

update_from_user_input(user_input)

Updates the element default values from user input. For Custom Events, this does nothing.

Parameters:

user_input – Input from a user on the platform.

class virtualitics_sdk.elements.custom_event.CustomEventPosition(value, names=None, *, module=None, qualname=None, type=None, start=1, boundary=None)

Bases: Enum

CENTER = 'center'
LEFT = 'left'
RIGHT = 'right'
class virtualitics_sdk.elements.custom_event.CustomEventType(value, names=None, *, module=None, qualname=None, type=None, start=1, boundary=None)

Bases: Enum

ASSET_DOWNLOAD = 'asset-download'
STANDARD = 'standard'
class virtualitics_sdk.elements.custom_event.TriggerFlowCustomEvent(title, description, flow_name, input_parameters=None, timeout=30, show_title=True, show_description=True, position=CustomEventPosition.RIGHT, **kwargs)

Bases: CustomEvent

Creates a custom event that triggers another flow with optional pre-supplied input parameters. Then wait for the flow to stop and return a redirect url to the last started step.

Parameters:
  • title (str) – The title of the custom event element.

  • description (str) – A description to go with this element on the page.

  • flow_name (str) – the Name of the Flow to be triggered

  • input_parameters (Optional[dict]) – an optional dictionary describing input parameters to be passed to the triggered flow

  • timeout (int) – timeout in seconds, the amount of time to wait for the triggered flow to stop [default = 30]

  • show_title (bool) – whether to show the title on the page when rendered, defaults to True.

  • show_description (bool) – whether to show the description to the page when rendered, defaults to True.

  • position (CustomEventPosition) – The position the event button should be placed, defaults to CustomEventPosition.RIGHT

  • kwargs

callback(flow_metadata)
Return type:

Union[str, dict]

final execute(flow_metadata)

Since this function executes the callback, we want to make it @final to prevent it from being modified in a subclass :type flow_metadata: :param flow_metadata: :rtype: Union[str, dict] :return: