From 905c13ec915cf25277ead5d90021dc588c911efe Mon Sep 17 00:00:00 2001 From: Edan Bainglass Date: Wed, 11 Dec 2024 12:29:50 +0000 Subject: [PATCH] Refresh available codes on code creation --- code_setup.ipynb | 42 ++++++++++++++++++------------------------ home/code_setup.py | 4 +--- 2 files changed, 19 insertions(+), 27 deletions(-) diff --git a/code_setup.ipynb b/code_setup.ipynb index 6cfbb33..859767c 100644 --- a/code_setup.ipynb +++ b/code_setup.ipynb @@ -29,25 +29,7 @@ "languageId": "html" } }, - "outputs": [ - { - "data": { - "text/html": [ - "\n", - "\n" - ], - "text/plain": [ - "" - ] - }, - "metadata": {}, - "output_type": "display_data" - } - ], + "outputs": [], "source": [ "%%html\n", "\n", @@ -97,7 +79,7 @@ ")\n", "\n", "ipw.VBox(\n", - " [\n", + " children=[\n", " widget,\n", " setup_message,\n", " ]\n", @@ -119,9 +101,17 @@ "source": [ "from home.code_setup import create_paginated_table, fetch_code_data\n", "\n", - "df = fetch_code_data()\n", - "paginated_table = create_paginated_table(df)\n", - "display(paginated_table)" + "output = ipw.Output()\n", + "\n", + "def render():\n", + " df = fetch_code_data()\n", + " paginated_table = create_paginated_table(df)\n", + " output.clear_output()\n", + " with output:\n", + " display(paginated_table)\n", + "\n", + "display(output)\n", + "render()" ] }, { @@ -129,7 +119,11 @@ "execution_count": null, "metadata": {}, "outputs": [], - "source": [] + "source": [ + "widget.quick_setup_button.on_click(\n", + " lambda _: render()\n", + ")" + ] } ], "metadata": { diff --git a/home/code_setup.py b/home/code_setup.py index 13576a8..16199fd 100644 --- a/home/code_setup.py +++ b/home/code_setup.py @@ -115,9 +115,7 @@ def on_show_all_click(_): render_table_with_filters() def on_checkbox_change(change): - full_label = change.owner.full_label - is_hidden = change.new - update_code_visibility(full_label, is_hidden) + update_code_visibility(change.owner.full_label, change.new) if show_active.value: render_table_with_filters()