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)
- 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: int | None = 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: int | None = 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: str | None = None, task_display_mode: SubprocessDisplayMode | None = '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: str | None = 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.
SideBar Classes¶
- class SideBarButton(side_bar_manager: SideBarManager, json: Dict | None = None, title: str | None = None, icon: str | None = None, uri: str | None = None, alignment: SidebarItemAlignment = 'top', minimum_access_level: SidebarAccessLevelOptions = 'is_member', uri_target: URITarget = 'internal', icon_mode: FontAwesomeMode = 'regular', **kwargs)[source]¶
Side-bar button class.
Every custom button in the side-bar is maintained as an object of this class. The original KE-chain buttons for the project detail, tasks and work breakdown structure are not separate buttons.
- 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.
Create a side-bar button.
- Parameters:
side_bar_manager – Manager object to which the button is linked.
json – the json response to construct the
SideBarButton
fromtitle – visible label of the button
icon – FontAwesome icon of the button
uri – Uniform Resource Identifier, the address of the linked page
uri_target – type of URI, either internal or external
alignment – alignment of the button top or bottom
minimum_access_level – the minimum permission needed to see the button
icon_mode – FontAwesome display mode of the icon
:returns None :raises IllegalArgumentError: When the provided Argument is not according to the type.
- class SideBarCard(side_bar_manager: SideBarManager, json: Dict | None = None, alignment: SidebarItemAlignment = 'top', minimum_access_level: SidebarAccessLevelOptions = 'is_member', maximum_access_level: SidebarAccessLevelOptions = 'is_manager', display_text: str = None, show_close_action: bool = True, show_background: bool = True, show_action_button: bool = False, action_button_name: str | None = None, action_button_uri: str | None = None, action_button_uri_target: str | None = None, display_text_align: Alignment | None = 'center', **kwargs: dict)[source]¶
Side-bar card class.
Every side-bar can have one or more cards and is maintained as an object of this class.
- 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.
Create a side-bar card.
- Parameters:
side_bar_manager – Manager object to which the button is linked.
json – the json response to construct the
SideBarButton
fromtitle – visible label of the button
icon – FontAwesome icon of the button
uri – Uniform Resource Identifier, the address of the linked page
uri_target – type of URI, either internal or external
alignment – alignment of the button top or bottom
minimum_access_level – the minimum permission needed to see the button
maximum_access_level – the maximum permission needed to see the button
icon_mode – FontAwesome display mode of the icon
:returns None :raises IllegalArgumentError: When the provided Argument is not according to the type.
- as_dict() → Dict[source]¶
Retrieve the configuration data, or meta, of the side-bar button.
- Returns:
dictionary of the configuration data
Example
- ```{
“itemType”: “CARD”, “order”: 5, “align”: “top”, “showCloseAction”: true, “showActionButton”: true, “actionButtonUri”: “https://asdasdas”, “actionButtonUriTarget”: “_new”, “actionButtonName”: “Discover more”, “displayText”: “This project …”, “displayText_nl”: “Dit project …”, “displayTextAlign”: “left”, “showBackground”: true, “minimumAccessLevel”: “is_member”, “maximumAccessLevel”: “is_supervisor”,
}```