sepal_ui.sepalwidgets.alert.Banner#

class sepal_ui.sepalwidgets.alert.Banner(**kwargs)[source]#

Custom Snackbar widget to display messages as a banner in module App.

Parameters:
  • msg (str) – Message to display in application banner. default to nothing

  • type_ (str) – Used to display an appropriate banner color. fallback to “info”.

  • id – unique banner identificator.

  • persistent (bool) – Whether to close automatically based on the length of message (False) or make it indefinitely open (True). Overridden if timeout duration is set.

  • kwargs (optional) – any parameter from a v.Alert. If set, ‘vertical’ and ‘top’ will be overwritten.

  • id_ (str)

Attributes

btn_close

the closing btn of the banner

Methods

__init__

Custom Snackbar widget to display messages as a banner in module App.

close

Close button event to close snackbar alert.

get_timeout

Calculate timeout in milliseconds to read the message.

set_btn

Change the btn display to inform the user on the number of banners in the queue.

Banner.__init__(msg='', type_='info', id_='', persistent=True, **kwargs)[source]#

Custom Snackbar widget to display messages as a banner in module App.

Parameters:
  • msg (str) – Message to display in application banner. default to nothing

  • type_ (str) – Used to display an appropriate banner color. fallback to “info”.

  • id – unique banner identificator.

  • persistent (bool) – Whether to close automatically based on the length of message (False) or make it indefinitely open (True). Overridden if timeout duration is set.

  • kwargs (optional) – any parameter from a v.Alert. If set, ‘vertical’ and ‘top’ will be overwritten.

  • id_ (str)

Return type:

None

Banner.close(*args)[source]#

Close button event to close snackbar alert.

Return type:

None

Banner.get_timeout(text)[source]#

Calculate timeout in milliseconds to read the message.

Parameters:

text (str) – the text displayed in the banner to adapt the duration of the timeout

Returns:

the duration of the timeout in milliseconds

Return type:

int

Banner.set_btn(nb_banner)[source]#

Change the btn display to inform the user on the number of banners in the queue.

Parameters:

nb_banner (int) – the number of banners in the queue

Return type:

None