Repository navigation
fix: make the stdisp cross-hair cursor work - #225
Merged
Merged
Conversation
Clicking in the left image raised "y must be a sequence", because the handlers passed scalars to Line2D.set_xdata and set_ydata, which Matplotlib now refuses. And the Cursor object was held only by a local variable while Matplotlib keeps bound-method callbacks weakly, so when show() did not block (a notebook, or a non-interactive backend) the clicks did nothing. The figure now keeps the cursor alive. The two xfail tests that recorded these bugs are now ordinary tests. Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
Up to standards ✅🟢 Issues
|
| Metric | Results |
|---|---|
| Complexity | 0 |
| Duplication | 0 |
NEW Get contextual insights on your PRs based on Codacy's metrics, along with PR and Jira context, without leaving GitHub. Enable AI reviewer
TIP This summary will be updated as you push new changes.
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
Image.stdisp(), the stereo pair viewer, had two bugs that left its cross-hair cursor unusable:RuntimeError: y must be a sequence. The click and move handlers passed a scalar toLine2D.set_xdataandset_ydata, which Matplotlib 3.11 refuses. They now pass[x, x]and[y, y].Cursorobject was held only by a local variable, and Matplotlib keeps bound-method callbacks weakly, so whereplt.show(block=True)returns at once (a notebook, or a non-interactive backend) the cursor was collected and the clicks did nothing. The figure now keeps a reference to it.Both were found by the new
stdisptests (PR 222), which recorded them as strictxfailtests. Those two tests are now ordinary tests.Testing
tests/test_image_io_extra.py: 42 passed, and onexfailthat belongs to a separate bug (Image.Readwith a wildcard).tests/test_image_io.pypasses, andmypyreports no issues. The click test plays the part of the user with simulated mouse events: a click in the left image places the cross-hairs, a drag over the right image readsd=-4.00, and a second test checks the cursor still works afterstdisp()has returned. Not run: CI on Windows or OpenCV 4 (CI will).This change was written with AI assistance (Claude Code) and the diff has been read by the maintainer.
🤖 Generated with Claude Code