Conversation
The single 570-line start_AdA_Picker function is split into: - Data/profile_data.jl: extracting the data to plot from a ProfileData (no GUI) - Picks/picks_io.jl: converting, saving and loading picks (no GUI) - Layout/building_blocks.jl: reusable pieces (titled panels, toggle lists, logo) - GUI/gui_state.jl: PickerGUI struct that replaces the global variables - Layout/main_layout.jl, Controls/*, Plotting/profile_plot.jl, Picks/picking_interaction.jl, FileIO/fileIO_utils.jl: the parts of this GUI - AdA_Picker.jl: start_AdA_Picker, which puts them together Also: errors in the asynchronous menu actions are now printed, cancelling the file dialog no longer throws, and start_AdA_Picker(data = ...) loads a profile directly. Co-Authored-By: Claude Opus 5.5 (1M context) <[email protected]>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Draft. Not meant to be merged before the course week. This is a proposal for the restructuring Marcel is planning. Take whatever parts are useful.
The GUI used to be a single 570-line
start_AdA_Pickerfunction that shared state through global variables. It is now split into small functions, and a struct holds the state of each window. The GUI looks and works as before (screenshots compared).New structure (
src/)Data/profile_data.jlProfileData: field/surface/point names, topography, grid, slices. Doesn't need the GUI.Picks/picks_io.jlsave_picks,load_picks,pick_points. Doesn't need the GUI.Layout/building_blocks.jltitled_panel,styled_toggle,toggle_list!,visible_if,add_logo!,hide_axis!GUI/gui_state.jlPickerGUIstruct (figure, panels, controls, profile, plots, picks). It replaces theglobal dragging, idx, picks, ax1, p1. The GUI started last is available withcurrent_gui().Layout/main_layout.jlControls/layout_main_controls.jlControls/data_controls.jlPlotting/profile_plot.jlPicks/picking_interaction.jlFileIO/fileIO_utils.jlload_profile!, and the menu actions as aDict(menu entry → function)AdA_Picker.jlstart_AdA_Picker, which puts everything together (~20 lines)To build a different GUI (e.g. horizontal profiles), you can reuse the data, picks and building-block functions and write another short
start_...function. Adding a menu entry means adding it toMAIN_MENU_OPTIONSandMAIN_MENU_ACTIONS.Small changes in behavior
start_AdA_Picker(data = ...)now loads a profile directly (aProfileDataor a jld2 filename). Before, the keyword argument was ignored.dVs) instead of "Select...".x_profileandFlatCrossSectionare removed from the field list by name, instead of dropping the last two entries.utils.jl(only commented-out code, replaced byadd_logo!/hide_axis!) and the unusedmenu_fileIO_response.test_playground.jlandAdA_VizPickTool_V1.txtare left untouched.Not changed: loading a second profile still draws the new plots on top of the old ones, and dragging picks still doesn't work.
Tests
The existing GUI tests only needed to switch from the old globals (
ax1,picks) tocurrent_gui(). I addedtest/test_data.jlfor the functions that don't need a GUI; those tests also run on the macOS CI runners, which have no OpenGL. Marcel wanted to add tests after the restructuring, so feel free to replace or extend them. All 52 tests pass locally on Julia 1.10 and 1.12.🤖 Generated with Claude Code