models.widgets

WidgetManager Class

class WidgetsManager(widgets: Iterable[Widget], activity: Activity, **kwargs)[source]

Manager for Widgets.

This is the list of widgets. The widgets in the list are accessible directly using an index, uuid of the widget, widget title or widget ‘ref’.

Construct a Widget Manager from a list of widgets.

You need to provide an Activity to initiate the WidgetsManager. Alternatively you may provide both a activity uuid and a Client.

Parameters:
  • widgets (List[Widget]) – list of widgets.

  • activity (Activity) – an Activity object

  • kwargs (dict or None) – additional keyword arguments

Returns:

None

Raises:

IllegalArgumentError – if not provided one of Activity or activity uuid and a Client

create_widgets(widgets: List[Dict]) List[Widget][source]

Create widgets in bulk.

Parameters:

widgets (List[Dict]) – list of dicts defining the configuration per widget.

:returns list of widgets :rtype: List[Widget]

create_widget(*args, **kwargs) Widget[source]

Create a widget inside an activity.

If you want to associate models (and instances) in a single go, you may provide a list of Property (models) to the readable_model_ids or writable_model_ids.

Alternatively you can use the alias, inputs and outputs which connect to respectively readable_model_ids and writable_models_ids.

Parameters:
  • activity (Activity or UUID) – activity objects to create the widget in.

  • widget_type – type of the widget, one of WidgetTypes

  • title (basestring or None) –

    1. title of the widget

  • meta (dict) – meta dictionary of the widget.

  • order (int or None) –

    1. order in the activity of the widget.

  • parent (Widget or UUID) –

    1. parent of the widget for Multicolumn and Multirow widget.

  • readable_models (list of properties or list of property id's) –

    1. list of property model ids to be configured as readable (alias = inputs)

  • writable_models (list of properties or list of property id's) –

    1. list of property model ids to be configured as writable (alias = outputs)

  • kwargs – additional keyword arguments to pass

Type:

string

Returns:

newly created widget

Return type:

Widget

Raises:
create_configured_widget(part: Part, all_readable: bool | None = None, all_writable: bool | None = None, readable_models: List[AnyProperty | str] | None = None, writable_models: List[AnyProperty | str] | None = None, **kwargs) Widget[source]

Create a widget with configured properties.

Parameters:
  • part (Part) – Part to retrieve the properties from if all_readable or all_writable is True.

  • all_readable (bool) – Selects all the Properties of part_model and configures them as readable in the widget

  • all_writable (bool) – Selects all the Properties of part_model and configures them as writable in the widget

  • readable_models (list of properties or list of property id's) –

    1. list of property model ids to be configured as readable (alias = inputs)

  • writable_models (list of properties or list of property id's) –

    1. list of property model ids to be configured as writable (alias = outputs)

  • kwargs – additional keyword arguments to pass

Returns:

Widget

add_supergrid_widget(part_model: Part | str, parent_instance: Part | str | None = None, title: None | str | bool = False, parent_widget: Widget | str | None = None, new_instance: bool | None = True, edit: bool | None = True, clone: bool | None = True, export: bool | None = True, upload: bool | None = True, delete: bool | None = False, incomplete_rows: bool | None = True, emphasize_new_instance: bool | None = True, emphasize_edit: bool | None = False, emphasize_clone: bool | None = False, emphasize_delete: bool | None = False, sort_property: AnyProperty | str | None = None, sort_direction: SortTable | str | None = 'ASC', show_name_column: bool | None = True, show_images: bool | None = False, readable_models: List[AnyProperty | str] | None = None, writable_models: List[AnyProperty | str] | None = None, all_readable: bool | None = False, all_writable: bool | None = False, **kwargs) Widget[source]

Add a KE-chain superGrid (e.g. basic table widget) to the customization.

The widget will be saved to KE-chain.

Parameters:
  • part_model (Part or UUID) – The part model based on which all instances will be shown.

  • parent_instance (Part or UUID) – The parent part instance for which the instances will be shown or to which new instances will be added.

  • title (bool or basestring or None) – A custom title for the supergrid:: * False (default): Part instance name * String value: Custom title * None: No title

  • new_instance (bool) – Show or hide the New instance button (default False). You need to provide a parent_instance in order for this to work.

  • edit (bool) – Show or hide the Edit button (default True)

  • clone (bool) – Show or hide the Clone button (default True)

  • export (bool) – Show or hide the Export Grid button (default True)

  • upload (bool) – Show or hide the Import Grid button (default True)

  • delete (bool) – Show or hide the Delete button (default False)

  • incomplete_rows (bool) – Show or hide the Incomplete Rows filter button (default True)

  • emphasize_new_instance (bool) – Emphasize the New instance button (default True)

  • emphasize_edit (bool) – Emphasize the Edit button (default False)

  • emphasize_clone (bool) – Emphasize the Clone button (default False)

  • emphasize_delete (bool) – Emphasize the Delete button (default False)

  • sort_property (Property or UUID) – The property model on which the part instances are being sorted on

  • sort_direction (basestring (see enums.SortTable)) – The direction on which the values of property instances are being sorted on: * ASC (default): Sort in ascending order * DESC: Sort in descending order

  • show_name_column (bool) –

    1. show the column with part names

  • show_images (bool) –

    1. show the attachments in the grid as images, not as hyperlinks (default False).

  • readable_models (list) – List of Property models or Property UUIDs to be configured in the widget as readable

  • writable_models (list) – List of Property models or Property UUIDs to be configured in the widget as writable

  • all_readable (bool) – Selects all the Properties of part_model and configures them as readable in the widget

  • all_writable (bool) – Selects all the Properties of part_model and configures them as writable in the widget

  • kwargs – additional keyword arguments to pass

Returns:

newly created widget

Return type:

Widget

Raises:
add_filteredgrid_widget(part_model: Part | str, parent_instance: Part | str | None = None, title: None | str | bool = False, parent_widget: Widget | str | None = None, new_instance: bool | None = True, edit: bool | None = True, clone: bool | None = True, export: bool | None = True, upload: bool | None = True, delete: bool | None = False, incomplete_rows: bool | None = True, emphasize_new_instance: bool | None = True, emphasize_edit: bool | None = False, emphasize_clone: bool | None = False, emphasize_delete: bool | None = False, sort_property: AnyProperty | str | None = None, sort_name: str | bool | None = False, sort_direction: SortTable | str | None = 'ASC', show_name_column: bool | None = True, show_images: bool | None = False, collapse_filters: bool | None = False, page_size: int | None = 25, readable_models: List[AnyProperty | str] | None = None, writable_models: List[AnyProperty | str] | None = None, all_readable: bool | None = False, all_writable: bool | None = False, excluded_propmodels: List[AnyProperty | str] | None = None, prefilters: List[PropertyValueFilter] | Dict | None = None, **kwargs) Widget[source]

Add a KE-chain superGrid (e.g. basic table widget) to the customization.

The widget will be saved to KE-chain.

Parameters:
  • part_model (Part or UUID) – The part model based on which all instances will be shown.

  • parent_instance (Part or UUID) – The parent part instance for which the instances will be shown or to which new instances will be added.

  • title (bool or basestring or None) – A custom title for the supergrid: * False (default): Part instance name * String value: Custom title * None: No title

  • new_instance (bool) – Show or hide the New instance button (default False). You need to provide a parent_instance in order for this to work.

  • edit (bool) – Show or hide the Edit button (default True)

  • clone (bool) – Show or hide the Clone button (default True)

  • export (bool) – Show or hide the Export Grid button (default True)

  • upload (bool) – Show or hide the Import Grid button (default True)

  • delete (bool) – Show or hide the Delete button (default False)

  • incomplete_rows (bool) – Show or hide the Incomplete Rows filter button (default True)

  • emphasize_new_instance (bool) – Emphasize the New instance button (default True)

  • emphasize_edit (bool) – Emphasize the Edit button (default False)

  • emphasize_clone (bool) – Emphasize the Clone button (default False)

  • emphasize_delete (bool) – Emphasize the Delete button (default False)

  • sort_property (Property or UUID) – The property model on which the part instances are being sorted on

  • sort_name (bool) – If set to True it will sort on name of the part. It is ignored if sort_property is None

  • sort_direction (basestring (see enums.SortTable)) – The direction on which the values of property instances are being sorted on: * ASC (default): Sort in ascending order * DESC: Sort in descending order

  • show_name_column (bool) –

    1. show the column with part names

  • show_images (bool) –

    1. show the attachments in the grid as images, not as hyperlinks (default False).

  • collapse_filters (bool) – Boolean to collapses the filters pane, or fully hide if None. (default = False)

  • page_size (int) – Number of parts that will be shown per page in the grid.

  • readable_models (list) – List of Property models or Property UUIDs to be configured in the widget as readable

  • writable_models (list) – List of Property models or Property UUIDs to be configured in the widget as writable

  • all_readable (bool) – Selects all the Properties of part_model and configures them as readable in the widget

  • all_writable (bool) – Selects all the Properties of part_model and configures them as writable in the widget

  • excluded_propmodels (list) –

    1. list of properties not shown in the filter pane

  • prefilters (dict) – (O) default filters active in the grid. Defined as either a list of PropertyValueFilter objects or a dict with the following fields: * property_models: list of Properties, defined as Property objects or UUIDs * values: the pre-filter value for each property to filter on * filters_type: the types of filters, either le, ge, icontains or exact

  • kwargs – additional keyword arguments to pass

Returns:

newly created widget

Return type:

Widget

Raises:
add_attachmentviewer_widget(attachment_property: str | AttachmentProperty, editable: bool | None = False, title: None | str | bool = False, parent_widget: Widget | str | None = None, alignment: Alignment | None = None, image_fit: str | ImageFitValue | None = 'contain', show_download_button: bool | None = True, show_full_screen_button: bool | None = True, **kwargs) Widget[source]

Add a KE-chain Attachment widget widget manager.

The widget will be saved to KE-chain.

Parameters:
  • attachment_property (AttachmentProperty) – KE-chain Attachment property to display

  • editable (bool) – Whether the attachment can be added, edited or deleted (default: False)

  • title (bool or basestring or None) – A custom title for the script widget * False (default): Property name * String value: Custom title * None: No title

  • alignment (Alignment) – horizontal alignment of the previewed attachment (Alignment enum class)

  • image_fit (basestring or None) –

    1. enumeration to address the image_fit (defaults to ‘contain’, otherwise ‘cover’)

  • show_download_button (bool) –

    1. whether a user can download the attached figure (defaults to True)

  • show_full_screen_button (bool) –

    1. whether the figure can be expanded to fit the full screen (defaults to True)

  • kwargs – additional keyword arguments to pass

Returns:

newly created widget

Return type:

Widget

Raises:
add_tasknavigationbar_widget(activities: Iterable[Dict], alignment: str | None = 'center', parent_widget: Widget | str | None = None, **kwargs) Widget[source]

Add a KE-chain Navigation Bar (e.g. navigation bar widget) to the activity.

The widget will be saved to KE-chain.

Parameters:
  • activities (list of dict) – List of activities. Each activity must be a Python dict(), with the following keys: * customText: A custom text for each button in the attachment viewer widget: None (default): Task name; a String value: Custom text * emphasized: bool which determines if the button should stand-out or not - default(False) * activityId: class Activity or UUID * isDisabled: (O) to disable the navbar button * link: str URL to external web page

  • alignment (basestring (see enums.NavigationBarAlignment)) – The alignment of the buttons inside navigation bar. One of Alignment * left: Left aligned * center (default): Center aligned * right: Right aligned

  • kwargs – additional keyword arguments to pass

Returns:

newly created widget

Return type:

Widget

Raises:
add_propertygrid_widget(part_instance: Part | str, title: None | str | bool = False, max_height: int | None = None, show_headers: bool | None = True, show_columns: Iterable[ShowColumnTypes] | None = None, parent_widget: Widget | str | None = None, readable_models: Iterable | None = None, writable_models: Iterable | None = None, all_readable: bool | None = False, all_writable: bool | None = False, **kwargs) Widget[source]

Add a KE-chain Property Grid widget to the customization.

The widget will be saved to KE-chain. :param part_instance: The part instance on which the property grid will be based :type part_instance: Part or UUID :param max_height: The max height of the property grid in pixels :type max_height: int or None :param title: A custom title for the property grid:

* False (default): Part instance name
* String value: Custom title
* None: No title
Parameters:
  • show_headers (bool) – Show or hide the headers in the grid (default True)

  • show_columns (list) – Columns to be hidden or shown (default to ‘unit’ and ‘description’)

  • parent_widget (Widget or basestring or None) –

    1. parent of the widget for Multicolumn and Multirow widget.

  • readable_models (list of properties or list of property id's) – list of property model ids to be configured as readable (alias = inputs)

  • writable_models (list of properties or list of property id's) – list of property model ids to be configured as writable (alias = outputs)

  • all_readable

    1. boolean indicating if all properties should automatically be configured as

readable (if True) or writable (if False). :type all_readable: bool :param all_writable: (O) boolean indicating if all properties should automatically be configured as writable (if True) or writable (if False). :type all_writable: bool :param kwargs: additional keyword arguments to pass :return: newly created widget :rtype: Widget :raises IllegalArgumentError: when incorrect arguments are provided :raises APIError: When the widget could not be created.

add_service_widget(service: Service, title: None | str | bool = False, custom_button_text: None | str | bool = False, emphasize_run: bool | None = True, alignment: Alignment | None = 'left', download_log: bool | None = False, show_log: bool | None = True, parent_widget: Widget | str | None = None, **kwargs) Widget[source]

Add a KE-chain Service (e.g. script widget) to the widget manager.

The widget will be saved to KE-chain.

Parameters:
  • service (Service or UUID) – The Service to which the button will be coupled and will be ran when the button is pressed.

  • title (bool or basestring or None) – A custom title for the script widget * False (default): Script name * String value: Custom title * None: No title

  • custom_button_text (bool or basestring or None) – A custom text for the button linked to the script * False (default): Script name * String value: Custom title * None: No title

  • emphasize_run (bool) – Emphasize the run button (default True)

  • alignment (Alignment) – Horizontal alignment of the button

  • download_log (bool) – Include the possibility of downloading the log inside the activity (default False)

  • show_log (bool) – Include the log message inside the activity (default True)

  • parent_widget (Widget or basestring or None) –

    1. parent of the widget for Multicolumn and Multirow widget.

  • kwargs – additional keyword arguments to pass

Returns:

newly created widget

Return type:

Widget

Raises:
add_html_widget(html: str | None, title: None | str | bool = None, parent_widget: Widget | str | None = None, **kwargs) Widget[source]

Add a KE-chain HTML widget to the widget manager.

The widget will be saved to KE-chain.

Parameters:
  • html (basestring or None) – The text that will be shown by the widget.

  • title (basestring or None) – A custom title for the text panel:: * None (default): No title * String value: Custom title

  • parent_widget (Widget or basestring or None) –

    1. parent of the widget for Multicolumn and Multirow widget.

  • kwargs – additional keyword arguments to pass

Returns:

newly created widget

Return type:

Widget

Raises:
add_notebook_widget(notebook: Service, title: None | str | bool = False, parent_widget: Widget | str | None = None, **kwargs) Widget[source]

Add a KE-chain Notebook (e.g. notebook widget) to the WidgetManager.

The widget will be saved to KE-chain.

Parameters:
  • notebook (Service or UUID) – The Notebook to which the button will be coupled and will start when the button is pressed.

  • title (bool or basestring or None) – A custom title for the notebook widget * False (default): Notebook name * String value: Custom title * None: No title

  • parent_widget (Widget or basestring or None) –

    1. parent of the widget for Multicolumn and Multirow widget.

  • kwargs – additional keyword arguments to pass

Returns:

newly created widget

Return type:

Widget

Raises:
add_metapanel_widget(show_all: bool | None = True, show_due_date: bool | None = False, show_start_date: bool | None = False, show_title: bool | None = False, show_status: bool | None = False, show_progress: bool | None = False, show_assignees: bool | None = False, show_breadcrumbs: bool | None = False, show_menu: bool | None = False, show_download_pdf: bool | None = False, show_progressbar: bool | None = False, progress_bar: Dict | None = None, breadcrumb_root: Activity | None = None, **kwargs) Widget[source]

Add a KE-chain Metapanel to the WidgetManager.

The widget will be saved to KE-chain.

Parameters:
  • show_all (bool) – Show all elements of the metapanel (defaults to True). If True other arguments are ignored.

  • show_due_date (bool) – show Due date

  • show_start_date (bool) – show Start date

  • show_title (bool) – Show Title of the activity

  • show_status (bool) – Show status

  • show_progress (bool) – Show progress. If True, the progressbar is not shown.

  • show_assignees (bool) – show Assignees

  • show_breadcrumbs (bool) – show Breadcrumbs

  • show_download_pdf (bool) – Show the Download PDF button

  • show_menu (bool) – show Menu

  • show_progressbar (bool) – Show the progress bar. Shown when progress is not True.

  • progress_bar – Progress bar custom settings. Allowed dictionary items `colorNoProgress, showProgressText,

showProgressText, customHeight, colorInProgress, colorCompleted, colorInProgressBackground` :type progress_bar: dict or None :param breadcrumb_root: Activity object or UUID to specify the breadcrumb root :type breadcrumb_root: Activity :param kwargs: additional keyword arguments to pass :return: newly created widget :rtype: Widget :raises IllegalArgumentError: when incorrect arguments are provided :raises APIError: When the widget could not be created.

add_progress_widget(height: int | None = 25, color_no_progress: str | ProgressBarColors | None = '#EEEEEE', color_completed: str | ProgressBarColors | None = '#339447', color_in_progress: str | ProgressBarColors | None = '#FF6600', color_in_progress_background: str | ProgressBarColors | None = '#FC7C3D', show_progress_text: bool | None = True, **kwargs) Widget[source]

Add a KE-chain progress bar widget to the WidgetManager.

The widget will be saved to KE-chain.

Parameters:
  • height – height of the progress bar, counted in pixels

  • color_no_progress – color option for when the progress bar is empty

  • color_completed – color option for when the progress bar is fully completed

  • color_in_progress – color option for the filled part of the progress bar

  • color_in_progress_background – color option for the empty part of the progress bar

  • show_progress_text – visualize the progress percentage

  • kwargs – additional keyword arguments to pass

Returns:

newly created widget

:rtype Widget

add_multicolumn_widget(title: None | str | bool = None, **kwargs) Widget[source]

Add a KE-chain Multi Column widget to the WidgetManager.

The widget will be saved to KE-chain.

Parameters:
  • title (bool or basestring or None) – A custom title for the multi column widget * False: Widget id * String value: Custom title * None (default): No title

  • kwargs – additional keyword arguments to pass

Returns:

newly created widget

Return type:

Widget

Raises:
add_scope_widget(team: Team | str = None, title: None | str | bool = None, add: bool | None = True, edit: bool | None = True, clone: bool | None = True, delete: bool | None = True, emphasize_add: bool | None = True, emphasize_edit: bool | None = False, emphasize_clone: bool | None = False, emphasize_delete: bool | None = False, show_columns: Iterable[str] | None = None, show_all_columns: bool | None = True, page_size: int | None = 25, tags: Iterable[str] | None = None, sorted_column: str | None = 'Name', sorted_direction: SortTable | None = 'ASC', parent_widget: Widget | str | None = None, active_filter: bool | None = True, search_filter: bool | None = True, **kwargs) Widget[source]

Add a KE-chain Scope widget to the WidgetManager and the activity.

The widget will be saved in KE-chain.

Parameters:

team (Team or basestring) – Team to limit the list of scopes to. Providing this is not obligated but highly preferred.

:param title:A custom title for the multi column widget
  • False: Widget id

  • String value: Custom title

  • None (default): No title

Parameters:
  • add (bool) –

    1. Show or hide the Add button (default True)

  • clone (bool) –

    1. Show or hide the Clone button (default True)

  • edit (bool) –

    1. Show or hide the Edit button (default True)

  • delete (bool) –

    1. Show or hide the Delete button (default True)

  • emphasize_add (bool) –

    1. Emphasize the Add button (default True)

  • emphasize_clone (bool) –

    1. Emphasize the Clone button (default False)

  • emphasize_edit (bool) –

    1. Emphasize the Edit button (default False)

  • emphasize_delete (bool) –

    1. Emphasize the Delete button (default False)

  • show_columns (list of basestring) –

    1. list of column headers to show. One of ScopeWidgetColumnTypes.

  • show_all_columns (bool) – boolean to show all columns (defaults to True). If True, will override show_columns

  • page_size (int) – number of scopes to show per page (defaults to 25)

  • tags (list of basestring) –

    1. list of scope tags to filter the Scopes on

  • sorted_column (basestring) – column name to sort on. (defaults to project name column). One of ScopeWidgetColumnTypes

  • sorted_direction (basestring) – The direction on which the values of property instances are being sorted on: * ASC (default): Sort in ascending order * DESC: Sort in descending order

  • parent_widget (Widget or basestring or None) –

    1. parent of the widget for Multicolumn and Multirow widget.

  • active_filter (bool) –

    1. whether to show the active-scopes filter, defaults to True

  • search_filter (bool) –

    1. whether to show the search filter, defaults to True

  • kwargs – additional keyword arguments to pass

Returns:

newly created widget

Return type:

Widget

Raises:
add_signature_widget(attachment_property: AttachmentProperty, title: None | str | bool = False, parent_widget: Widget | str | None = None, custom_button_text: str | bool | None = False, custom_undo_button_text: str | bool | None = False, editable: bool | None = True, show_name_and_date: bool | None = True, **kwargs) Widget[source]

Add a KE-chain Signature widget to the Widgetmanager and the activity.

The widget will be saved in KE-chain.

Parameters:
  • attachment_property (AttachmentProperty) – KE-chain Attachment property to display

  • title (bool or basestring or None) – A custom title for the script widget * False (default): Script name * String value: Custom title * None: No title

  • parent_widget (Widget or basestring or None) –

    1. parent of the widget for Multicolumn and Multirow widget.

  • custom_button_text (bool or basestring) – Custom text for ‘Add signature’ button

  • custom_undo_button_text (bool or basestring) – Custom text for ‘Remove signature’ button

  • editable (bool) – (optional) if False, creates a viewable, not editable, signature widget (default = True)

  • show_name_and_date (bool) – (optional) if True, embeds the name and date on the signature widget (default = True)

  • kwargs – additional keyword arguments to pass

Returns:

newly created widget

Return type:

Widget

Raises:
add_card_widget(image: AttachmentProperty | None = None, title: None | str | bool = False, parent_widget: Widget | str | None = None, description: str | bool | None = None, link: None | str | bool | KEChainPages = None, link_value: CardWidgetLinkValue | None = None, link_target: str | LinkTargets | None = '_self', image_fit: str | ImageFitValue | None = 'contain', **kwargs) Widget[source]

Add a KE-chain Card widget to the WidgetManager and the activity.

The widget will be saved in KE-chain.

Parameters:
  • image – AttachmentProperty providing the source of the image shown in the card widget.

  • title – A custom title for the card widget * False (default): Card name * String value: Custom title * None: No title

  • description – Custom text shown below the image in the card widget * False (default): Card name * String value: Custom title * None: No title

  • link – Where the card widget refers to. This can be one of the following: * None (default): no link * task: another KE-chain task, provided as an Activity object or its UUID * String value: URL to a webpage * KE-chain page: built-in KE-chain page of the current scope

  • parent_widget (Widget or basestring or None) –

    1. parent of the widget for Multicolumn and Multirow widget.

  • link_value (CardWidgetLinkValue) – Overwrite the default link value (obtained from the type of the link)

  • link_target (CardWidgetLinkTarget) – how the link is opened, one of the values of CardWidgetLinkTarget enum.

  • image_fit (ImageFitValue) – how the image on the card widget is displayed

Returns:

Card Widget

add_weather_widget(weather_property: Property, autofill: bool | None = None, title: None | str | bool = False, parent_widget: Widget | str | None = None, **kwargs) Widget[source]

Add a KE-chain Weather widget to the Widgetmanager and the activity.

The widget will be saved in KE-chain.

Parameters:
  • weather_property (Property) – KE-chain Weather property to display

  • title (bool or basestring or None) – A custom title for the script widget * False (default): Script name * String value: Custom title * None: No title

  • parent_widget (Widget or basestring or None) –

    1. parent of the widget for Multicolumn and Multirow widget.

  • kwargs – additional keyword arguments to pass

Returns:

newly created widget

Return type:

Widget

Raises:
add_service_card_widget(service: Service, image: AttachmentProperty | None = None, title: None | str | bool = False, description: str | None = None, parent_widget: Widget | str | None = None, custom_button_text: None | str | bool = False, emphasize_run: bool | None = True, alignment: Alignment | None = 'left', link: None | str | bool | KEChainPages = None, link_value: CardWidgetLinkValue | None = None, link_target: str | LinkTargets | None = '_self', image_fit: str | ImageFitValue | None = 'contain', **kwargs) Widget[source]

Add a KE-chain Service Card widget to the WidgetManager and the activity.

The widget will be saved in KE-chain.

Parameters:
  • service (Service or UUID) – The Service to which the button will be coupled and will be ran when the button is pressed.

  • image – AttachmentProperty providing the source of the image shown in the card widget.

  • title – A custom title for the card widget * False (default): Card name * String value: Custom title * None: No title

  • description – Custom text shown below the image in the card widget * False (default): Card name * String value: Custom title * None: No title

  • parent_widget (Widget or basestring or None) –

    1. parent of the widget for Multicolumn and Multirow widget.

  • custom_button_text (bool or basestring or None) – A custom text for the button linked to the script * False (default): Script name * String value: Custom title * None: No title

  • emphasize_run (bool) – Emphasize the run button (default True)

  • alignment (Alignment) – Horizontal alignment of the button

  • link – Where the card widget refers to. This can be one of the following: * None (default): no link * task: another KE-chain task, provided as an Activity object or its UUID * String value: URL to a webpage * KE-chain page: built-in KE-chain page of the current scope

  • link_value (CardWidgetLinkValue) – Overwrite the default link value (obtained from the type of the link)

  • link_target (CardWidgetLinkTarget) – how the link is opened, one of the values of CardWidgetLinkTarget enum.

  • image_fit (ImageFitValue) – how the image on the card widget is displayed

Returns:

Service Card Widget

add_dashboard_widget(title: None | str | bool = False, parent_widget: Widget | str | None = None, source_scopes: DashboardWidgetSourceScopes | None = 'project', source_scopes_tags: List | None = None, source_subprocess: List | None = None, source_selected_scopes: List | None = None, show_tasks: List[DashboardWidgetShowTasks] | None = None, show_form_status: List[DashboardWidgetShowForms] | None = None, show_scopes: List[DashboardWidgetShowScopes] | None = None, no_background: bool | None = False, show_forms: bool | None = False, show_assignees: bool | None = True, show_assignees_table: bool | None = True, show_open_task_assignees: bool | None = True, show_open_vs_closed_tasks: bool | None = True, show_open_closed_tasks_assignees: bool | None = True, show_form_status_per_assignees: bool | None = True, show_assignees_for_form_statuses: bool | None = True, show_status_category_forms: bool | None = True, **kwargs) Widget[source]

Add a KE-chain Dashboard Widget to the WidgetManager and the activity.

The widget will be saved in KE-chain

Parameters:
  • title – A custom title for the card widget * False (default): Card name * String value: Custom title * None: No title

  • parent_widget (Widget or basestring or None) –

    1. parent of the widget for Multicolumn and Multirow widget.

  • source_scopes (basestring (see models.widgets.enums.DashboardWidgetSourceScopes)) – The Project(s) to be used as source when displaying the Widget. Defaults on CURRENT_SCOPE.

  • source_scopes_tags (list of tags) – Tags on which the source projects can be filtered on. Source is selected automatically as TAGGED_SCOPES

  • source_subprocess (list of str (UUID of an Activity)) – Subprocess that the Widget uses as source. Source is selected automatically SUBPROCESS

  • source_selected_scopes (list of str (UUIDs of Scopes)) – List of Scope to be used by the Widget as source. Source is selected automatically as SELECTED_SCOPES

  • show_forms (bool) – Show all dashboard widgets based on forms within the scope

  • show_tasks (list of basestring (see models.widgets.enums.DashboardWidgetShowTasks)) – Type of tasks to be displayed in the Widget. If left None, all of them will be selected

  • show_form_status

    Type of statuses to be displayed in the Widget. If left None,

    all of them will be selected

    type show_form_status:

    list of basestring (see models.widgets.enums.DashboardWidgetShowForms)

  • show_scopes (list of basestring (see: class:models.widgets.enums.DashboardWidgetShowScopes)) – Type of scopes to be displayed in the Widget. If left None, all of them will be selected

  • no_background (bool) – Reverse the shadows (default False)

  • show_assignees (bool) – Show the assignees pie chart

  • show_assignees_table (bool) – Show the assignees table

  • show_open_task_assignees (bool) – Show the Open tasks per assignees pie chart

  • show_open_vs_closed_tasks (bool) – Show the Open vs closed tasks pie chart

  • show_open_closed_tasks_assignees (bool) – Show the Open open and closed tasks per assignees pie chart

  • show_form_status_per_assignees (bool) – Show the Status categories per form pie chart

  • show_assignees_for_form_statuses (bool) – Show the Show assignees per status form pie chart

  • show_status_category_forms (bool) – Show the Show Forms Status per assignee chart

  • kwargs

Returns:

add_tasks_widget(title: None | str | bool = False, parent_widget: Widget | str | None = None, add: bool | None = True, clone: bool | None = True, edit: bool | None = True, delete: bool | None = True, emphasize_add: bool | None = True, emphasize_clone: bool | None = False, emphasize_edit: bool | None = False, emphasize_delete: bool | None = False, show_my_tasks_filter: bool | None = True, show_open_tasks_filter: bool | None = True, show_search_filter: bool | None = True, parent_activity: Activity | str | None = None, assigned_filter: TasksAssignmentFilterTypes | None = 'ALL', status_filter: ActivityStatus | None = None, activity_type_filter: ActivityType | None = 'TASK', classification_filter: ActivityClassification | None = 'WORKFLOW', tags_filter: List[str] | None = (), collapse_filter: bool | None = False, show_columns: List[TasksWidgetColumns] | None = None, sorted_column: TasksWidgetColumns | None = None, sorted_direction: SortTable | None = 'ASC', page_size: int | None = 25, **kwargs) Widget[source]

Add a KE-chain Tasks Widget to the WidgetManager and the activity.

The widget will be saved in KE-chain

Parameters:
  • title – A custom title for the card widget * False (default): Card name * String value: Custom title * None: No title

  • parent_widget (Widget or basestring or None) –

    1. parent of the widget for Multicolumn and Multirow widget.

  • add (bool) – Show the “add task” button, only visible if a parent_activity is provided (default = True)

  • clone (bool) – Show the “clone task” button (default = True)

  • edit (bool) – Show the “edit task” button (default = True)

  • delete (bool) – Show the “delete task” button (default = True)

  • emphasize_add (bool) – Show green backdrop for “add task” button (default = True)

  • emphasize_clone (bool) – Show green backdrop for “clone task” button (default = False)

  • emphasize_edit (bool) – Show green backdrop for “edit task” button (default = False)

  • emphasize_delete (bool) – Show green backdrop for “delete task” button (default = False)

  • show_my_tasks_filter (bool) – Show the switch to filter on assigned tasks (default = True)

  • show_open_tasks_filter (bool) – Show the switch to filter on tasks with status OPEN (default = True)

  • show_search_filter (bool) – Show textfield to filter on a task name (default = True)

  • parent_activity (Activity) – Filter on task parent Activity, thereby enabling the “add task” button

  • assigned_filter (TasksAssignmentFilterTypes) – Filter on the assignment of the tasks (default = ALL)

  • status_filter (ActivityStatus) – Filter on the status of the tasks (default = OPEN)

  • activity_type_filter (ActivityType) – Filter on the activity type (default = TASK)

  • classification_filter (ActivityClassification) – Filter on the activity classification (default = WORKFLOW)

  • tags_filter (list) – Filter on list of tags

  • collapse_filter (bool) – Collapse the filter pane, or hide the pane if None (default = False)

  • show_columns (list) – List of task attributes to show (default = all)

  • sorted_column (TasksWidgetColumns) – Task attribute to sort on (default = no sorting)

  • sorted_direction (SortTable) – Direction of sorting (default = ascending)

  • page_size (int) – Number of tasks to show per pagination (default = 25)

Returns:

Task widget

:rtype Widget

add_scopemembers_widget(title: None | str | bool = False, parent_widget: Widget | str | None = None, add: bool | None = True, edit: bool | None = True, remove: bool | None = True, show_username_column: bool | None = True, show_name_column: bool | None = True, show_email_column: bool | None = True, show_role_column: bool | None = True, **kwargs) Widget[source]

Add a KE-chain Scope Members Widget to the WidgetManager and the activity.

The widget will be saved in KE-chain

Parameters:
  • title – A custom title for the card widget * False (default): Card name * String value: Custom title * None: No title

  • parent_widget (Widget or basestring or None) –

    1. parent of the widget for Multicolumn and Multirow widget.

  • add (bool) – Show “add user” button (default = True)

  • edit (bool) – Show “edit role” button (default = True)

  • remove (bool) – Show “remove user” button (default = True)

  • show_username_column (bool) – Show “username” column (default = True)

  • show_name_column (bool) – Show “name” column (default = True)

  • show_email_column (bool) – Show “email” column (default = True)

  • show_role_column (bool) – Show “role” column (default = True)

Returns:

Scope members Widget

:rtype Widget

add_project_info_widget(title: None | str | bool = False, parent_widget: Widget | str | None = None, **kwargs) Widget[source]

Add a KE-chain Project Info Widget to the WidgetManager and the activity.

The widget will be saved in KE-chain.

Parameters:
  • title – A custom title for the card widget. * False (default): Card name * String value: Custom title * None: No title

  • parent_widget (Widget or basestring or None) –

    1. parent of the widget for Multicolumn and Multirow widget.

Returns:

Project info Widget

:rtype Widget

add_projectinfo_widget(*args, **kwargs)[source]

Add a KE-chain Project Info Widget to the WidgetManager and the activity.

The widget will be saved in KE-chain.

insert(index: int, widget: Widget) None[source]

Insert a widget at index n, shifting the rest of the list to the right.

if widget order is [w0,w1,w2] and inserting w3 at index 1 (before Widget1); the list will be [w0,w3,w1,w2]

Parameters:
  • index (int) – integer (position) starting from 0 at first position in which the widget is inserted

  • widget (Widget) – Widget object to insert

Returns:

None

Raises:
  • IndexError – The index is out of range

  • APIError – The list of widgets could not be updated

delete_widget(key: Any) bool[source]

Delete a widget in the task.

Parameters:

key (Widget, int or basestring) – index, uuid, title or ref of the widget to delete, or the widget itself.

Returns:

True if the widget is deleted successfully

Raises:
  • APIError – if the widget could not be deleted

  • NotFoundError – if the WidgetsManager (activity) has no such widget

delete_all_widgets() None[source]

Delete all widgets in the activity.

Returns:

None

Raises:

ApiError – When the deletion of the widgets was not successful

Base Widget Class

class Widget(json: Dict, manager: WidgetsManager = None, **kwargs)[source]

A virtual object representing a KE-chain Widget.

Variables:
  • id (basestring) – UUID of the widget

  • title (basestring) – Title of the widget

  • ref (basestring) – Reference of the widget

  • widget_type (basestring) – Type of the widget. Should be one of WidgetTypes

  • meta (dict) – Meta definition of the widget

  • order (int) – Order of the widget in the list of widgets

  • has_subwidgets (bool) – if the widgets contains any subwidgets. In case this widget being eg. a Multicolumn

  • progress (float) – Progress of the widget

Construct a Widget from a KE-chain 2 json response.

Parameters:

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

property title_visible: str | None

Return the title of the widget displayed in KE-chain.

Returns:

title string

:rtype str

activity() Activity[source]

Activity associated to the widget.

Returns:

The Activity

Return type:

Activity

parent() Widget[source]

Parent widget.

Returns:

The parent of this widget.

Return type:

Widget

validate_meta(meta: Dict) Dict[source]

Validate the meta and return the meta if validation is successfull.

Parameters:

meta (dict) – meta of the widget to be validated.

Return meta:

if the meta is validated correctly

Raise:

ValidationError

classmethod create(json: Dict, **kwargs) Widget[source]

Create a widget based on the json data.

This method will attach the right class to a widget, enabling the use of type-specific methods.

It does not create a widget object in KE-chain. But a pseudo Widget object.

Parameters:

json (dict) – the json from which the Widget object to create

Returns:

a Widget object

Return type:

Widget

parts(*args, **kwargs) Any[source]

Retrieve parts belonging to this widget.

Without any arguments it retrieves the Instances related to this widget only.

This call only returns the configured properties in an widget. So properties that are not configured are not in the returned parts.

See pykechain.Client.parts for additional available parameters.

associated_parts(*args, **kwargs)[source]

Retrieve models and instances belonging to this widget.

This is a convenience method for the Widget.parts() method, which is used to retrieve both the Category.MODEL as well as the Category.INSTANCE in a tuple.

This call only returns the configured (associated) properties in a widget. So properties that are not configured (associated) are not in the returned parts.

If you want to retrieve only the models associated to this task it is better to use:

Widget.parts(category=Category.MODEL).

See pykechain.Client.parts() for additional available parameters.

Returns:

a tuple(models of PartSet, instances of PartSet)

update_associations(readable_models: List | None = None, writable_models: List | None = None, part_instance: Part | str | None = None, parent_part_instance: Part | str | None = None, **kwargs) None[source]

Update associations on this widget.

This is a patch to the list of associations: Existing associations are modified but not removed.

Alternatively you may use inputs or outputs as a alias to readable_models and writable_models respectively.

Parameters:
  • readable_models (List[Property] or List[UUID] or None) – list of property models (of Property or property_ids (uuids) that has read rights (alias = inputs)

  • writable_models (List[Property] or List[UUID] or None) – list of property models (of Property or property_ids (uuids) that has write rights (alias = outputs)

  • part_instance (Part or UUID) – Part object or UUID to be used as instance of the widget

  • parent_part_instance (Part or UUID) – Part object or UUID to be used as parent of the widget

  • kwargs – additional keyword arguments to be passed into the API call as param.

Returns:

None

Raises:
set_associations(readable_models: List | None = None, writable_models: List | None = None, part_instance: Part | str | None = None, parent_part_instance: Part | str | None = None, **kwargs) None[source]

Set associations on this widget.

This is an absolute list of associations. If you provide No models, than the associations are cleared.

Alternatively you may use inputs or outputs as a alias to readable_models and writable_models respectively.

Parameters:
  • readable_models (List[Property] or List[UUID] or None) – list of property models (of Property or property_ids (uuids) that has read rights (alias = inputs)

  • writable_models (List[Property] or List[UUID] or None) – list of property models (of Property or property_ids (uuids) that has write rights (alias = outputs)

  • part_instance (Part or UUID) – Part object or UUID to be used as instance of the widget

  • parent_part_instance (Part or UUID) – Part object or UUID to be used as parent of the widget

  • kwargs – additional keyword arguments to be passed into the API call as param.

Returns:

None

Raises:
remove_associations(models: List[Property | str], **kwargs) None[source]

Remove associated properties from the widget.

Parameters:

models – list of Properties or their uuids

Returns:

None

edit(title: None | str | bool | ~pykechain.utils.Empty = <pykechain.utils.Empty object>, meta: ~typing.Dict | None = None, **kwargs) None[source]

Edit the details of a widget.

Parameters:
  • title (basestring, None or False) – New title for the widget * False: use the default title, depending on the widget type * String value: use this title * None: No title at all

  • meta (dict or None) – (optional) new Meta definition

Raises:

APIError – if the widget could not be updated.

delete() bool[source]

Delete the widget.

Returns:

True when successful

Return type:

bool

Raises:

APIError – when unable to delete the activity

copy(target_activity: Activity, order: int | None = None) Widget[source]

Copy the widget.

Parameters:
  • target_activity (Activity) – Activity object under which the desired Widget is copied

  • order (int or None) – (optional) order in the activity of the widget.

Returns:

copied :class:`Widget `

Raises:

IllegalArgumentError – if target_activity is not Activity

>>> source_activity = project.activity('Source task')
>>> target_activity = project.activity('Target task')
>>> widget_manager = source_activity.widgets()
>>> widget_to_copy = widget_manager[1]
>>> widget_to_copy.copy(target_activity=target_activity, order=3)
move(target_activity: Activity, order: int | None = None) Widget[source]

Move the widget.

Parameters:
  • target_activity (Activity) – Activity object under which the desired Widget is moved

  • order (int or None) – (optional) order in the activity of the widget.

Returns:

copied :class:`Widget `

Raises:

IllegalArgumentError – if target_activity is not Activity

download_as_excel(target_dir: str | None = None, file_name: str | None = None, user: User = None) str[source]

Export a grid widget as an Excel sheet.

Parameters:
  • target_dir (str) – directory (path) to store the Excel sheet.

  • file_name (str) – optional, name of the Excel file

  • user (User) – User object to create timezone-aware datetime values

Returns:

file path of the created Excel sheet

:rtype str

Widget Classes

class MetapanelWidget(json: Dict, manager: WidgetsManager = None, **kwargs)[source]

Metapanel Widget.

Construct a Widget from a KE-chain 2 json response.

Parameters:

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

class FormmetapanelWidget(json: Dict, manager: WidgetsManager = None, **kwargs)[source]

FormMetapanel Widget.

Construct a Widget from a KE-chain 2 json response.

Parameters:

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

class PropertygridWidget(json: Dict, manager: WidgetsManager = None, **kwargs)[source]

Propertygrid Widget.

Construct a Widget from a KE-chain 2 json response.

Parameters:

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

class UndefinedWidget(json: Dict, manager: WidgetsManager = None, **kwargs)[source]

Undefined Widget.

Construct a Widget from a KE-chain 2 json response.

Parameters:

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

class FilteredgridWidget(json: Dict, manager: WidgetsManager = None, **kwargs)[source]

Filteredgrid Widget.

Construct a Widget from a KE-chain 2 json response.

Parameters:

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

class SupergridWidget(json: Dict, manager: WidgetsManager = None, **kwargs)[source]

Supergrid Widget.

Construct a Widget from a KE-chain 2 json response.

Parameters:

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

class AttachmentviewerWidget(json: Dict, manager: WidgetsManager = None, **kwargs)[source]

Attachmentviewer Widget.

Construct a Widget from a KE-chain 2 json response.

Parameters:

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

class TasknavigationbarWidget(json: Dict, manager: WidgetsManager = None, **kwargs)[source]

Tasknavigationbar Widget.

Construct a Widget from a KE-chain 2 json response.

Parameters:

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

class HtmlWidget(json: Dict, manager: WidgetsManager = None, **kwargs)[source]

HTML Widget.

Construct a Widget from a KE-chain 2 json response.

Parameters:

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

class ServiceWidget(json: Dict, manager: WidgetsManager = None, **kwargs)[source]

Service Widget.

Construct a Widget from a KE-chain 2 json response.

Parameters:

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

class NotebookWidget(json: Dict, manager: WidgetsManager = None, **kwargs)[source]

Notebook Widget.

Construct a Widget from a KE-chain 2 json response.

Parameters:

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

class JsonWidget(json: Dict, manager: WidgetsManager = None, **kwargs)[source]

JSON Widget.

Construct a Widget from a KE-chain 2 json response.

Parameters:

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

class MulticolumnWidget(json: Dict, manager: WidgetsManager = None, **kwargs)[source]

Multicolumn Widget.

Construct a Widget from a KE-chain 2 json response.

Parameters:

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

class ProgressWidget(json: Dict, manager: WidgetsManager = None, **kwargs)[source]

Progress bar Widget.

Construct a Widget from a KE-chain 2 json response.

Parameters:

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

class ScopeWidget(json: Dict, manager: WidgetsManager = None, **kwargs)[source]

Scope grid Widget.

Construct a Widget from a KE-chain 2 json response.

Parameters:

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

class SignatureWidget(json: Dict, manager: WidgetsManager = None, **kwargs)[source]

Signature Widget.

Construct a Widget from a KE-chain 2 json response.

Parameters:

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

class CardWidget(json: Dict, manager: WidgetsManager = None, **kwargs)[source]

Card Widget.

Construct a Widget from a KE-chain 2 json response.

Parameters:

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

class ThirdpartyWidget(json: Dict, manager: WidgetsManager = None, **kwargs)[source]

Thirdparty Widget.

Construct a Widget from a KE-chain 2 json response.

Parameters:

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

class TasksWidget(json: Dict, manager: WidgetsManager = None, **kwargs)[source]

Tasks Widget.

Construct a Widget from a KE-chain 2 json response.

Parameters:

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

class WeatherWidget(json: Dict, manager: WidgetsManager = None, **kwargs)[source]

Weather Widget.

Construct a Widget from a KE-chain 2 json response.

Parameters:

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

class ServicecardWidget(json: Dict, manager: WidgetsManager = None, **kwargs)[source]

ServiceCard Widget.

Construct a Widget from a KE-chain 2 json response.

Parameters:

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

class DashboardWidget(json: Dict, manager: WidgetsManager = None, **kwargs)[source]

Dashboard Widget.

Construct a Widget from a KE-chain 2 json response.

Parameters:

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

class ScopemembersWidget(json: Dict, manager: WidgetsManager = None, **kwargs)[source]

ScopeMembers Widget.

Construct a Widget from a KE-chain 2 json response.

Parameters:

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