sepal_ui.sepalwidgets.sepalwidget.SepalWidget#
- class sepal_ui.sepalwidgets.sepalwidget.SepalWidget(**kwargs)[source]#
Custom vuetifyWidget to add specific methods.
- Parameters:
viz (Bool) – define if the widget should be visible or not
tooltip (str) – tooltip text of the widget. If set the widget will be displayed on
self.widget
(irreversible).
Attributes
old_class
a saving attribute of the widget class
viz
whether the widget is displayed or not
with_tooltip
the full widget and its tooltip.
Methods
Custom vuetifyWidget to add specific methods.
Recursively search for every element matching the specifications.
Hide the widget by reducing the html class to
d-none
.Clear the widget v_model.
Insert input children in self children within given position.
Create a tooltip associated with the widget.
Show the widget by removing the d-none html class.
Toggle the visibility of the widget.
- SepalWidget.__init__(viz=True, tooltip='', **kwargs)[source]#
Custom vuetifyWidget to add specific methods.
- Parameters:
viz (bool) – define if the widget should be visible or not
tooltip (str) – tooltip text of the widget. If set the widget will be displayed on
self.widget
(irreversible).
- Return type:
None
- SepalWidget.get_children(widget=None, klass=None, attr='', value='', id_='', elements=None)[source]#
Recursively search for every element matching the specifications.
multiple parameters can be used to search for matching elements. no error is raised if nothing is found.
- Parameters:
widget (VuetifyWidget | None) – the widget to search into
klass (Type[VuetifyWidget] | None) – the vuetify widget class to look for . Leave empty for any.
attr (str) – the attribute to look at. leave empty for no search
value (str) – the value of the attr. ignored if attr is not set
elements (list | None) – the list used to store found elements
id_ (str)
- Returns:
List containing all matching elements
- Return type:
List[VuetifyWidget]
Retrieve all children elements that matches with the given id_.
- Parameters:
id_ (str, optional) – attribute id to compare with.
widget (VuetifyWidget | None)
klass (Type[VuetifyWidget] | None)
attr (str)
value (str)
elements (list | None)
- Returns:
list with all matching elements if there are more than one, otherwise will return the matching element.
- Return type:
List[VuetifyWidget]
- SepalWidget.hide()[source]#
Hide the widget by reducing the html class to
d-none
.Save the previous class and set viz attribute to False.
- Return type:
Self
- SepalWidget.reset()[source]#
Clear the widget v_model.
Need to be extended in custom widgets to fit the structure of the actual input.
- Return type:
Self
- SepalWidget.set_children(children, position='first')[source]#
Insert input children in self children within given position.
- Parameters:
children (str | VuetifyWidget | list) – the list of children to add to the widget. It can also be a list (str and DOMWidgets are accepted)
position (str) – whether to insert as first or last element. [“first”, “last”]
- Return type:
Self
- SepalWidget.set_tooltip(txt='', **kwargs)[source]#
Create a tooltip associated with the widget.
If the text is not set, the tooltip will be automatically removed. Once the tooltip is set the object variable can be accessed normally but to render the widget, one will need to use
self.with_tooltip
(irreversible).- Parameters:
txt (str) – anything False (0, False, empty text, None) will lead to the removal of the tooltip. everything else will be used to fill the text area
kwargs – any options available in a Tooltip widget
- Returns:
the tooltip associated with the object
- Return type:
Tooltip
New in version 2.9.0: Tooltip are now integrated to widgets