diff --git a/demo/voila_demo.ipynb b/demo/voila_demo.ipynb index 9fe7726..040c12a 100644 --- a/demo/voila_demo.ipynb +++ b/demo/voila_demo.ipynb @@ -351,16 +351,24 @@ " atl06_rsps.leaflet.redraw()\n", "\n", "# show code action\n", + "global code06_is_shown\n", + "code06_is_shown = False\n", "def on_show_code06_clicked(b):\n", - " global url_textbox, atl06_parms\n", + " global url_textbox, atl06_parms, code06_is_shown\n", " with show_code06_output:\n", " display.clear_output()\n", - " print(f'icesat2.init()')\n", - " # validate boolean entries to be in title case\n", - " atl06_json = json.dumps(atl06_parms, indent=4)\n", - " atl06_json = re.sub(r'\\b(true|false)', lambda m: m.group(1).title(), atl06_json)\n", - " print('parms = ', atl06_json, sep='')\n", - " print('gdf = icesat2.atl06p(parms)')\n", + " code06_is_shown = not code06_is_shown\n", + " if code06_is_shown:\n", + " print(f'icesat2.init()')\n", + " # validate boolean entries to be in title case\n", + " atl06_json = json.dumps(atl06_parms, indent=4)\n", + " atl06_json = re.sub(r'\\b(true|false)', lambda m: m.group(1).title(), atl06_json)\n", + " print('parms = ', atl06_json, sep='')\n", + " print('gdf = icesat2.atl06p(parms)')\n", + " show_code06_button.description = \"Unshow Code\"\n", + " else:\n", + " show_code06_button.description = \"Show Code\"\n", + "\n", "\n", "# Download ATL06-SR data as geojson\n", "display.display(download_output)\n", @@ -449,7 +457,7 @@ "# display buttons\n", "display.display(run_button)\n", "display.display(SRwidgets.HBox([download_atl06_button, SRwidgets.file_format]))\n", - "display.display(SRwidgets.HBox([show_code06_button, show_code06_output]))" + "display.display(show_code06_button, show_code06_output)" ] }, { @@ -639,17 +647,23 @@ "m.add_selected_callback(click_handler)\n", "\n", "# show code action\n", + "global code03_is_shown\n", + "code03_is_shown = False\n", "def on_show_code03_clicked(b):\n", - " global url_textbox, atl03_parms\n", + " global url_textbox, atl03_parms, code03_is_shown\n", " with show_code03_output:\n", " display.clear_output()\n", - " print(f'icesat2.init()')\n", - " # validate boolean entries to be in title case\n", - " atl03_json = json.dumps(atl03_parms, indent=4)\n", - " atl03_json = re.sub(r'\\b(true|false)', lambda m: m.group(1).title(), atl03_json)\n", - " print('parms = ', atl03_json, sep='')\n", - " print('gdf = icesat2.atl03sp(parms)')\n", - "\n", + " code03_is_shown = not code03_is_shown\n", + " if code03_is_shown:\n", + " print(f'icesat2.init()')\n", + " # validate boolean entries to be in title case\n", + " atl03_json = json.dumps(atl03_parms, indent=4)\n", + " atl03_json = re.sub(r'\\b(true|false)', lambda m: m.group(1).title(), atl03_json)\n", + " print('parms = ', atl03_json, sep='')\n", + " print('gdf = icesat2.atl03sp(parms)')\n", + " show_code03_button.description = \"Unshow Code\"\n", + " else:\n", + " show_code03_button.description = \"Show Code\"\n", "\n", "def on_atl03_download_clicked(e=None):\n", " download_file(atl03_rsps, SRwidgets.atl03_filename,\n",