From f64bf481252c29b472b89c5de3926e8af7add03a Mon Sep 17 00:00:00 2001 From: lizzy985 Date: Sun, 1 Dec 2024 21:17:57 -0700 Subject: [PATCH 1/2] docs update code griddraggable --- .../components/layout/griddraggable.py | 42 +++++++++---------- 1 file changed, 21 insertions(+), 21 deletions(-) diff --git a/solara/website/pages/documentation/components/layout/griddraggable.py b/solara/website/pages/documentation/components/layout/griddraggable.py index 245cbffe2..24f13fb7b 100644 --- a/solara/website/pages/documentation/components/layout/griddraggable.py +++ b/solara/website/pages/documentation/components/layout/griddraggable.py @@ -33,30 +33,30 @@ def Page(): # some placeholders items = [ColorCard(title=f"Child {i}", color=colors[i]) for i in range(len(grid_layout))] - with solara.VBox() as main: - resizable = solara.ui_checkbox("Allow resizing", value=True) - draggable = solara.ui_checkbox("Allow dragging", value=True) - def reset_layout(): - set_grid_layout(grid_layout_initial) + resizable = solara.ui_checkbox("Allow resizing", value=True) + draggable = solara.ui_checkbox("Allow dragging", value=True) - solara.Button("Reset to initial layout", on_click=reset_layout) + def reset_layout(): + set_grid_layout(grid_layout_initial) - solara.GridDraggable(items=items, grid_layout=grid_layout, resizable=resizable, draggable=draggable, on_grid_layout=set_grid_layout) + solara.Button("Reset to initial layout", on_click=reset_layout) - # some string kung fu to make this print nicely - grid_layout_formatted = pprint.pformat(grid_layout, indent=4) - grid_layout_formatted = textwrap.indent(grid_layout_formatted, " " * len("grid_layout = ")) - grid_layout_formatted = grid_layout_formatted[len("grid_layout = ") :] - solara.Markdown( - f""" - # Resulting layout + solara.GridDraggable(items=items, grid_layout=grid_layout, resizable=resizable, draggable=draggable, on_grid_layout=set_grid_layout) - This layout can be copy pasted to put in your code as an initial layout: + # some string kung fu to make this print nicely + grid_layout_formatted = pprint.pformat(grid_layout, indent=4) + grid_layout_formatted = textwrap.indent(grid_layout_formatted, " " * len("grid_layout = ")) + grid_layout_formatted = grid_layout_formatted[len("grid_layout = ") :] + solara.Markdown( + f""" + # Resulting layout - ```python - grid_layout = {grid_layout_formatted} - ``` - """ - ) - return main + This layout can be copy pasted to put in your code as an initial layout: + + ```python + grid_layout = {grid_layout_formatted} + ``` + """ + ) + From ac499e015acd051b984a0176f2e63fdba408f036 Mon Sep 17 00:00:00 2001 From: "pre-commit-ci[bot]" <66853113+pre-commit-ci[bot]@users.noreply.github.com> Date: Mon, 2 Dec 2024 04:19:42 +0000 Subject: [PATCH 2/2] [pre-commit.ci] auto fixes from pre-commit.com hooks for more information, see https://pre-commit.ci --- .../pages/documentation/components/layout/griddraggable.py | 1 - 1 file changed, 1 deletion(-) diff --git a/solara/website/pages/documentation/components/layout/griddraggable.py b/solara/website/pages/documentation/components/layout/griddraggable.py index 24f13fb7b..f38bd5044 100644 --- a/solara/website/pages/documentation/components/layout/griddraggable.py +++ b/solara/website/pages/documentation/components/layout/griddraggable.py @@ -59,4 +59,3 @@ def reset_layout(): ``` """ ) -