Skip to content

gridstate

Grid layout dataclass

GridState = GridData() module-attribute #

GridData instance for app

GridData #

Class holding current state of grid layout.

Note

All modifying functions are nested as subfunctions of ObjectGrid.

Attributes:

Name Type Description
grid_layout Reactive[list[dict[str, int]]]

list of grid layout properties per item

objects Reactive[list[Any]]

list of widgets to render

states Reactive[list[PlotState]]

list of states, for exporting

index Reactive[int]

index, used for ensuring unique state between widgets

Source code in src/sdss_explorer/dashboard/dataclass/gridstate.py
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
class GridData:
    """
    Class holding current state of grid layout.

    Note:
        All modifying functions are nested as subfunctions of `ObjectGrid`.

    Attributes:
        grid_layout (sl.Reactive[list[dict[str,int]]]): list of grid layout properties per item
        objects (sl.Reactive[list[Any]]): list of widgets to render
        states (sl.Reactive[list[PlotState]]): list of states, for exporting
        index (sl.Reactive[int]): index, used for ensuring unique state between widgets
    """

    def __init__(self, objects=[], layout=[], states=[]) -> None:
        self.grid_layout = sl.reactive(layout)
        self.objects = sl.reactive(objects)
        self.states = sl.reactive(states)
        self.index = sl.reactive(len(objects))

    def __repr__(self) -> str:
        return str({
            "uuid": State.uuid,
            "objects": self.objects.value,
            "layout": self.grid_layout.value,
        })