Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Enh: Simplify controlling text of ImageInspectorOverlay #431

Merged
merged 9 commits into from
Jun 10, 2019

Conversation

jonathanrocher
Copy link
Collaborator

@jonathanrocher jonathanrocher commented Feb 20, 2019

  • Refactor ImageInspectorOverlay._new_value_updated to add a new method ImageInspectorOverlay._build_text_from_event to build the text to display, so it is easier to subclass and customize. Feedback on new method name welcome.
  • Added a few unit tests for the tool and overlay since nothing existed.

Unrelated: the unit tests pointed out some tool behavior that doesn't make sense to me: if hasattr(plot, "_cached_mapped_image") is False, the data value is collected with key color_value instead of data_value. Does that seem wrong to anyone else?

@jonathanrocher
Copy link
Collaborator Author

Ready for feedback/review. cc @corranwebster @jwiggins

Copy link
Contributor

@jvkersch jvkersch left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM, just one request to change the test file name.

chaco/tools/tests/image_inspector_test_case.py Outdated Show resolved Hide resolved
@jvkersch
Copy link
Contributor

jvkersch commented Jun 7, 2019

if hasattr(plot, "_cached_mapped_image") is False, the data value is collected with key color_value instead of data_value. Does that seem wrong to anyone else?

Where exactly does this happen?

@jonathanrocher
Copy link
Collaborator Author

if hasattr(plot, "_cached_mapped_image") is False, the data value is collected with key color_value instead of data_value. Does that seem wrong to anyone else?

Where exactly does this happen?

Compare line 78 to line 71 of chaco/tools/image_inspector_tool.py in the new version in this PR. The data value is being stored with key color_value. For consistency with the other if case, I would expect that data to be stored in data_value, but that wouldn't be backward compatible.

@jonathanrocher
Copy link
Collaborator Author

@jvkersch Thanks for reviewing my PR. I made the file name change and this is ready for a second look.

@jvkersch
Copy link
Contributor

Compare line 78 to line 71 of chaco/tools/image_inspector_tool.py in the new version in this PR. The data value is being stored with key color_value.

Ah, thanks for pointing that out. That is almost certainly a bug... I agree with changing it to use data_value for the key -- I cannot imagine how this would have been functional otherwise.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants