|
351 | 351 | " atl06_rsps.leaflet.redraw()\n", |
352 | 352 | "\n", |
353 | 353 | "# show code action\n", |
| 354 | + "global code06_is_shown\n", |
| 355 | + "code06_is_shown = False\n", |
354 | 356 | "def on_show_code06_clicked(b):\n", |
355 | | - " global url_textbox, atl06_parms\n", |
| 357 | + " global url_textbox, atl06_parms, code06_is_shown\n", |
356 | 358 | " with show_code06_output:\n", |
357 | 359 | " display.clear_output()\n", |
358 | | - " print(f'icesat2.init()')\n", |
359 | | - " # validate boolean entries to be in title case\n", |
360 | | - " atl06_json = json.dumps(atl06_parms, indent=4)\n", |
361 | | - " atl06_json = re.sub(r'\\b(true|false)', lambda m: m.group(1).title(), atl06_json)\n", |
362 | | - " print('parms = ', atl06_json, sep='')\n", |
363 | | - " print('gdf = icesat2.atl06p(parms)')\n", |
| 360 | + " code06_is_shown = not code06_is_shown\n", |
| 361 | + " if code06_is_shown:\n", |
| 362 | + " print(f'icesat2.init()')\n", |
| 363 | + " # validate boolean entries to be in title case\n", |
| 364 | + " atl06_json = json.dumps(atl06_parms, indent=4)\n", |
| 365 | + " atl06_json = re.sub(r'\\b(true|false)', lambda m: m.group(1).title(), atl06_json)\n", |
| 366 | + " print('parms = ', atl06_json, sep='')\n", |
| 367 | + " print('gdf = icesat2.atl06p(parms)')\n", |
| 368 | + " show_code06_button.description = \"Hide Code\"\n", |
| 369 | + " else:\n", |
| 370 | + " show_code06_button.description = \"Show Code\"\n", |
| 371 | + "\n", |
364 | 372 | "\n", |
365 | 373 | "# Download ATL06-SR data as geojson\n", |
366 | 374 | "display.display(download_output)\n", |
|
449 | 457 | "# display buttons\n", |
450 | 458 | "display.display(run_button)\n", |
451 | 459 | "display.display(SRwidgets.HBox([download_atl06_button, SRwidgets.file_format]))\n", |
452 | | - "display.display(SRwidgets.HBox([show_code06_button, show_code06_output]))" |
| 460 | + "display.display(show_code06_button, show_code06_output)" |
453 | 461 | ] |
454 | 462 | }, |
455 | 463 | { |
|
639 | 647 | "m.add_selected_callback(click_handler)\n", |
640 | 648 | "\n", |
641 | 649 | "# show code action\n", |
| 650 | + "global code03_is_shown\n", |
| 651 | + "code03_is_shown = False\n", |
642 | 652 | "def on_show_code03_clicked(b):\n", |
643 | | - " global url_textbox, atl03_parms\n", |
| 653 | + " global url_textbox, atl03_parms, code03_is_shown\n", |
644 | 654 | " with show_code03_output:\n", |
645 | 655 | " display.clear_output()\n", |
646 | | - " print(f'icesat2.init()')\n", |
647 | | - " # validate boolean entries to be in title case\n", |
648 | | - " atl03_json = json.dumps(atl03_parms, indent=4)\n", |
649 | | - " atl03_json = re.sub(r'\\b(true|false)', lambda m: m.group(1).title(), atl03_json)\n", |
650 | | - " print('parms = ', atl03_json, sep='')\n", |
651 | | - " print('gdf = icesat2.atl03sp(parms)')\n", |
652 | | - "\n", |
| 656 | + " code03_is_shown = not code03_is_shown\n", |
| 657 | + " if code03_is_shown:\n", |
| 658 | + " print(f'icesat2.init()')\n", |
| 659 | + " # validate boolean entries to be in title case\n", |
| 660 | + " atl03_json = json.dumps(atl03_parms, indent=4)\n", |
| 661 | + " atl03_json = re.sub(r'\\b(true|false)', lambda m: m.group(1).title(), atl03_json)\n", |
| 662 | + " print('parms = ', atl03_json, sep='')\n", |
| 663 | + " print('gdf = icesat2.atl03sp(parms)')\n", |
| 664 | + " show_code03_button.description = \"Hide Code\"\n", |
| 665 | + " else:\n", |
| 666 | + " show_code03_button.description = \"Show Code\"\n", |
653 | 667 | "\n", |
654 | 668 | "def on_atl03_download_clicked(e=None):\n", |
655 | 669 | " download_file(atl03_rsps, SRwidgets.atl03_filename,\n", |
|
0 commit comments