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

silx.gui.plot.PlotWidget: Changed add* methods return value to return the item instead of its legend #3996

Merged
merged 6 commits into from
Dec 13, 2023

Conversation

t20100
Copy link
Member

@t20100 t20100 commented Dec 13, 2023

Merge PR #3988 first!

This PR introduces a breaking API change: PlotWidget.add* methods (namely addCurve, addImage, addHistogram, addScatter, addShape, addMarker, addXMarker, addYMarker) now returns the created/updated PlotWidget item instead of its legend.

To mitigate this API break, PlotWidget.remove* methods and PlotWidget.get* methods were update to accept an item instance as their legend attribute. Together with setActive* methods accepting item, this should make the API change seamless for code that was using the legend as an identifier of the item in the PlotWidget without using it otherwise.

PlotWidget.get* methods log a warning when passed an item instance since this call is no longer needed.

Changes to examples/ and tests were minimal and actually not needed to make it run.

closes #3990

@t20100 t20100 added this to the 2.0.0 milestone Dec 13, 2023
@t20100 t20100 force-pushed the plot-add-return-items branch from 6a91b1e to 5f3ac3d Compare December 13, 2023 13:01
@t20100
Copy link
Member Author

t20100 commented Dec 13, 2023

Added some tests, ready for review.

@t20100 t20100 marked this pull request as ready for review December 13, 2023 13:02
@t20100 t20100 force-pushed the plot-add-return-items branch from 5f3ac3d to 85ff3cf Compare December 13, 2023 15:42
@vallsv vallsv self-requested a review December 13, 2023 15:59
@vallsv vallsv merged commit 4434ec7 into silx-kit:main Dec 13, 2023
7 checks passed
@t20100 t20100 deleted the plot-add-return-items branch December 13, 2023 16:02
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.

Change PlotWidget.add* methods to return the corresponding Item instance
2 participants