deepcave.utils.layout

# Layout

This module provides utilities to customize the layout.

This includes a help button, slider marks, select/checklist/radio options.

Functions

create_table(output[, fixed, head, striped, mb])

Create a table from the given data.

get_checklist_options([labels, values, binary])

Get a list of dictionaries of checklist options.

get_radio_options([labels, values, binary])

Get a list of dictionaries of radio options.

get_select_options([labels, values, ...])

Get dictionaries of the selected options.

get_slider_marks([strings, steps, access_all])

Generate a dictionary containing slider marks.

help_button(text[, placement])

Generate button with help icon.

render_table(df)

deepcave.utils.layout.create_table(output, fixed=False, head=True, striped=True, mb=True)[source]

Create a table from the given data.

Parameters:
  • output (Dict[str, List[str]]) – Containing the information for the table.

  • fixed (bool, optional) – Indicates whether the table has a fixed layout. Default is False.

  • head (bool, optional) – Indicates whether the head will be included. Default is True.

  • striped (bool, optional) – Indicates whether the rows will be striped. Default is True.

  • mb (bool, optional) – Indicates whether the table has a margin. Default is True.

Returns:

The created dash bootstrap component (DBC) table.

Return type:

dbc.Table

deepcave.utils.layout.get_checklist_options(labels=None, values=None, binary=False)[source]

Get a list of dictionaries of checklist options.

Parameters:
  • labels (Any, optional) – To specify the labels of the options. If labels are None, use values als labels. Default is None.

  • values (Any, optional) – To specify the values corresponding to the options. If values are None, use labels as values. Default is None

  • binary (bool, optional) – Define whether to return two dictionaries with binary choices. Only when both values and labels are None. Default is False.

Returns:

A list of dictionaries of the checklist options.

Return type:

List[Dict[str, Any]]

Raises:

ValueError – If the labels and values do not have the same length.

deepcave.utils.layout.get_radio_options(labels=None, values=None, binary=False)[source]

Get a list of dictionaries of radio options.

Parameters:
  • labels (Any, optional) – To specify the labels of the options. If labels are None, use values als labels. Default is None.

  • values (Any, optional) – To specify the values corresponding to the options. If values are None, use labels as values. Default is None

  • binary (bool, optional) – Define whether to return two dictionaries with binary choices. Only when both values and labels are None. Default is False.

Returns:

A list of dictionaries of the radio options.

Return type:

List[Dict[str, Any]]

Raises:

ValueError – If the labels and values do not have the same length.

deepcave.utils.layout.get_select_options(labels=None, values=None, disabled=None, binary=False)[source]

Get dictionaries of the selected options.

If values are none use labels as values. If both are none return empty list.

Parameters:
  • labels (Any, optional) – To specify the labels of the options. If labels are None, use values als labels. Default is None.

  • values (Any, optional) – To specify the values corresponding to the options. If values are None, use labels as values. Default is None

  • disabled (Union[List[Bool], None], optional) – A list containing information whether each option should be disabled or not. Default is None.

  • binary (bool, optional) – Define whether to return two dictionaries with binary choices. Only when both values and labels are None. Default is False.

Returns:

A list of dictionaries of the selected options.

Return type:

List[Dict[str, Any]]

Raises:

ValueError – If the labels and values do not have the same length.

deepcave.utils.layout.get_slider_marks(strings=None, steps=10, access_all=False)[source]

Generate a dictionary containing slider marks.

The slider marks are based on the provided list of dictionaries.

Parameters:
  • strings (Optional[List[Dict[str, Any]]], optional) – List of dictionaries containing information about the marks. Default value is None.

  • steps (int, optional) – Number of steps or marks on the slider. Default is 10.

  • access_all (bool, optional) – Indicates whether to create marks for all items. Default is False.

Returns:

Contains information about the positions and labels of the marks.

Return type:

Dict[int, Dict[str, str]]

deepcave.utils.layout.help_button(text, placement='top')[source]

Generate button with help icon.

Displays popover when hovered over that contains the provided text.

Parameters:
  • text (str) – The text that will be displayed in the popover.

  • placement (str, optional) – The placement of the button, default is Top.

Returns:

An html structure, that wraps the icon and the popover.

Return type:

html.Span