v3.0.1: Fix toolbar crashes outside the tree view + treemap hit-testing - #5
Merged
Merged
Conversation
Review of the v3.0.0 release surfaced three real, user-facing defects. All three are reproduced by new regression tests that fail without the fix. 1. Zip/Delete crashed with AttributeError when the app opened in a view that has no selection. v3.0.0 remembers the last view, so anyone who left the app in Treemap hit this on the very next launch: self.tree was only ever created by the tree view, but the toolbar buttons are visible in every view. 2. Zip/Delete crashed with TclError after switching views. Switching destroys the previous view's widgets, and the selection helpers kept reaching for the destroyed treeview. 3. The treemap tooltip and click-to-zoom were lost whenever the pointer was over a tile's own name label - the most natural place to aim. Canvas hit-testing resolves to the topmost item, and the label was not mapped back to its tile. Fixes: - Selection is now resolved through _selection_context(), which returns the widget and node map owned by the view currently on screen, or nothing at all. Stale widget references are dropped when a view is torn down, and the toolbar explains which view to switch to instead of raising. - Zip/Delete/Open-in-Explorer now also work against the Largest Files view, which is where oversized files are actually found. - Async deletion carries the originating widget and map, so navigating away mid-delete can no longer touch a destroyed widget; the in-memory sizes still update correctly either way. - Treemap labels map back to their tile, restoring hover and zoom. - Treemap redraws are debounced, so a window resize triggers one re-layout instead of one per <Configure> event. Testing: - New tests/test_gui.py (7 tests) covers each regression against a real Tk display, and skips cleanly where none exists. - CI installs xvfb on Linux so those tests actually run; Windows runs them directly. 44 tests pass. - Verified end to end headlessly: real deletions from both views, a view switch mid-delete, treemap hit-testing, and resize debouncing. Co-Authored-By: Claude <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_011HEb3UbLzGGY4KuK54H45Q
The Windows runner failed on an assertion in the new test, not in the app: 43 tests passed there and the meaningful check (no synchronous redraw during a burst) held on both platforms. The flaky assertion assumed Tk emits <Configure> when a packed canvas's requested width changes, which Windows does not guarantee. Drive the scheduler directly instead, and assert the whole contract: 40 events collapse into exactly one redraw and the pending handle is cleared. A separate test asserts the <Configure> handler is actually bound, so the wiring is still covered. Verified the rewritten test fails when the debounce is removed. Co-Authored-By: Claude <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_011HEb3UbLzGGY4KuK54H45Q
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.
Summary
A review pass over the v3.0.0 release turned up three real, user-facing defects. Each one is now reproduced by a regression test that fails without the fix (verified by reverting the fix and watching the test go red).
AttributeError: no attribute 'tree'self.treeis only created by the tree view.TclError: invalid command name ...treeviewFixes
_selection_context(), which returns the widget and node map owned by the view currently on screen, or nothing. Stale references are dropped on teardown, and the toolbar shows a hint about which view to switch to instead of raising.<Configure>event (measured: 30–40 resize events → 0 synchronous redraws).Testing
tests/test_gui.py(7 tests) exercising each regression against a real Tk display; skips cleanly where none exists (verified:1 skippedwith noDISPLAY).Patch release 3.0.1.
🤖 Generated with Claude Code
https://claude.ai/code/session_011HEb3UbLzGGY4KuK54H45Q
Generated by Claude Code