models.sidebar

SideBarManager Class

class SideBarManager(scope: Scope, *args, **kwargs)[source]

Sidebar manager class.

Variables
  • scope – Scope object for which the side-bar is managed.

  • bulk_creation – boolean to create buttons in bulk, postponing updating of KE-chain until the manager is deleted from memory (end of your function)

Create a side-bar manager object for the Scope object.

Parameters
  • scope – Scope for which to create the side-bar manager.

  • bulk_creation – flag whether to update once (True) or continuously (False, default)

refresh() None[source]

Reload the scope options from KE-chain to refresh the side-bar data.

remove(key: Any) None[source]

Remove a button from the side-bar.

Parameters

key – either a button, index, or name.

:returns None

insert(index: int, button: SideBarItem) None[source]

Place a button at index index of the button-list.

Parameters
  • index – location index of the new button

  • button – a side-bar button object

create_card(order: Optional[int] = None, *args, **kwargs) SideBarCard[source]

Create a side bar card.

Parameters

order – Optional input to specify where the button is injected in the list of items.

Returns

new side-bar card

create_button(order: Optional[int] = None, *args, **kwargs) SideBarButton[source]

Create a side-bar button.

Parameters

order – Optional input to specify where the button is injected in the list of items.

Returns

new side-bar button

add_task_button(activity: Activity, title: Optional[str] = None, task_display_mode: Optional[SubprocessDisplayMode] = 'activities', *args, **kwargs) SideBarButton[source]

Add a side-bar button to a KE-chain activity.

Parameters
  • activity – Activity object

  • title – Title of the side-bar button, defaults to the activity name

  • task_display_mode – for sub-processes, vary the display mode in KE-chain

Returns

new side-bar button

add_ke_chain_page(page_name: KEChainPages, title: Optional[str] = None, *args, **kwargs) SideBarButton[source]

Add a side-bar button to a built-in KE-chain page.

Parameters
  • page_name – name of the KE-chain page

  • title – Title of the side-bar button, defaults to the page_name

Returns

new side-bar button

add_external_button(url: str, title: str, *args, **kwargs) SideBarButton[source]

Add a side-bar button to an external page defined by an URL.

Parameters
  • title – title of the button

  • url – URL to an external page

Returns

new side-bar button

add_buttons(buttons: List[Dict], override_sidebar: bool) List[SideBarItem][source]

Create a list of buttons in bulk. Each button is defined by a dict, provided in a sorted list.

Parameters
  • buttons – list of dicts

  • override_sidebar – whether to override the default sidebar menu items.

Returns

list of SideBarButton objects

delete_button(key: Any) None[source]

Similar to the remove method, deletes a button.

Parameters

key – either a button, index or name

Returns

None

property override_sidebar: bool

Flag to indicate whether the original KE-chain side-bar is still shown.

Returns

boolean, True if original side-bar is not visible

SideBarItem Base Class

class SideBarItem[source]

A base class for all various sidebar ‘widgets’.

Variables
  • allowed_attributes – allowed additional attributed provided as options alongside the specifically allowed ones.

  • item_type – the item type of this class. Defaults to a BUTTON.

refresh(json: Optional[Dict] = None) None[source]

Refresh the object in-place using the provided json.

Parameters

json (dict) – the json response to construct the SideBarButton from

Returns

None

edit(**kwargs) None[source]

Edit the details of the button.

Parameters

kwargs

Returns

None

delete() None[source]

Delete the side-bar button from the side-bar.

Returns

None

as_dict() Dict[source]

Represent the sidebar object as a dictionary.