StateIcon#
StateIcon is a custom widget to provide easy to use a mutable icon state: displaying a short description of the state with a tooltip and a descriptive color. This widget is intended to be linked with a SepalModel trait, which will be in charge of changing the widget state. Here is an example:
import ipyvuetify as v
from traitlets import Unicode
from pysepal import sepalwidgets as sw
from pysepal.model import Model
# correct colors for the documentation
# set to dark in SEPAL by default
v.theme.dark = False
# Define a dummy model to manipulate externally the icon state
class TestModel(Model):
state_value = Unicode().tag(sync=True)
model = TestModel()
state_icon_a = sw.StateIcon(model, "state_value")
state_icon_b = sw.StateIcon(model, "state_value")
state_icon_b.value = "non_valid"
sw.Col(children=[
sw.Flex(xs12=True, children=[state_icon_a]),
sw.Divider(class_="my-5"),
sw.Flex(xs12=True, children=[state_icon_b]),
])
/home/docs/checkouts/readthedocs.org/user_builds/sepal-ui/envs/latest/lib/python3.10/site-packages/google/api_core/_python_version_support.py:273: FutureWarning: You are using a Python version (3.10.19) which Google will stop supporting in new releases of google.api_core once it reaches its end of life (2026-10-04). Please upgrade to the latest Python version, or at least Python 3.11, to continue receiving updates for google.api_core past that date. warnings.warn(message, FutureWarning)
Note
More information can be found here.