wxGUI/animation: Integrate g.gui.animation into the GUI as a tab - #7823
Open
saket0187 wants to merge 1 commit into
Open
wxGUI/animation: Integrate g.gui.animation into the GUI as a tab#7823saket0187 wants to merge 1 commit into
g.gui.animation into the GUI as a tab#7823saket0187 wants to merge 1 commit into
Conversation
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.
This PR tries to add animation as a tab just like gmodeler.
AI summary
## ProblemThe Animation Tool always opens in its own top-level window, including in the
Single-Window layout where every other tool of its kind is a notebook tab. It
is the odd one out next to the Graphical Modeler, and it does not participate
in the docking, tab and statusbar behaviour the Single-Window layout provides.
Changes
Split the tool the same way the Graphical Modeler is split:
animation/panels.py(new) holdsAnimationPanel(wx.Panel, MainPageBase)with all of the logic, along with
AnimationsPaneland the slider classesmoved unchanged from
animation/frame.py.animation/frame.pykeepsAnimationFrame, now a thinwx.Framewhichcreates a statusbar and hosts the panel, mirroring
gmodeler/frame.py.main_window/frame.pybuilds the panel withdockable=True, callsSetUpPage()and adds it tomainnotebook, so it opens as a tab. It returnsthe panel so a caller can load data into it.
Behaviour outside the Single-Window layout is unchanged:
g.gui.animationandthe multi-window layout (
lmgr/frame.py) both keep usingAnimationFrameandopen a separate window. The menu handler name is unchanged, so no menu data
needed editing, and the animation Makefile installs the new module already
since it globs.
Two pre-existing bugs are fixed as a consequence of the split:
would have overwritten each other's path; it is now per instance
for win in self.windows, thatis four times, which was harmless only because PyDispatcher deduplicates
receivers
Panes are laid out again on resize, because dragging the notebook tab reparents
the panel and the panes otherwise keep their pre-drag layout until some other
event forces an update.
Testing
Verified that the classes moved out of
animation/frame.pyare byte-identicalto their previous version, and that every method of the old
AnimationFrameexists on
AnimationPanel.InitStatusbaris the one exception: the frame nowcreates the statusbar and the panel writes to it through
SetStatusText, whichis what lets the tab use the main window's statusbar.
Checked the collaborators against the panel:
controller.pyuses onlyAddWindow,IsWindowShown,RemoveWindow,SetSliderandanimationPanel;toolbars.pycallsself.parent.On*includingOnCloseWindow;notebook.pypasses
askIfSaveWorkspaceonly toMapPanel, so the panel'sOnCloseWindow(event=None)signature is right.With the panel separated, a Data Catalog context menu entry for space time
datasets becomes straightforward:
OnAnimationTool()returns the panel, andAnimationPanel.LoadDataset()takes a dataset, so an entry can open the taband load the dataset without going through
g.gui.animation, which wouldalways open a separate window.
Claude assistance was used for the refactoring and the review.