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

add row select to plugin table #3381

Merged
merged 7 commits into from
Jan 9, 2025

Conversation

cshanahan1
Copy link
Contributor

@cshanahan1 cshanahan1 commented Jan 6, 2025

add row select method to Table and table mixin to allow selection by row index, indicies, or slice(s). Also adds 'select all' method.

@github-actions github-actions bot added the imviz label Jan 6, 2025
@cshanahan1 cshanahan1 marked this pull request as ready for review January 7, 2025 21:39
@cshanahan1 cshanahan1 added this to the 4.1.1 milestone Jan 7, 2025
@cshanahan1 cshanahan1 modified the milestones: 4.1.1, 4.2 Jan 8, 2025
Copy link
Contributor

@javerbukh javerbukh left a comment

Choose a reason for hiding this comment

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

LGTM!

@cshanahan1 cshanahan1 requested a review from javerbukh January 8, 2025 20:32
Copy link
Contributor

@javerbukh javerbukh left a comment

Choose a reason for hiding this comment

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

Still good!

Copy link
Contributor

@gibsongreen gibsongreen left a comment

Choose a reason for hiding this comment

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

Exposing these looks good to me! There were 2 things I was thinking about when testing.

One is if we want a more applicable Error to be thrown if there is yet to be a catalog loaded, or if the no sources were found and the user tries to select.

The second, I don't think deselecting a particular row would get much use from the API (although deselecting rows and deselecting all is possible from the UI), but deselect_all might be nice to have too.

@cshanahan1
Copy link
Contributor Author

cshanahan1 commented Jan 9, 2025

@gibsongreen thanks for the review, I added the 'deselect_all' method

I'm trying to decide what to do about warnings. Since this is not catalog plugin specific, adding a check in the table class's select_rows for the presence of a catalog doesn't make sense and I'm not sure if it would be worth doing this in the plugin by overriding select_rows, raising the warning, then calling table.select_rows. I think the resulting index error is fairly informative if you try to select from a non-populated table, personally. Happy to make this change though if you disagree

@pllim
Copy link
Contributor

pllim commented Jan 9, 2025

I'm trying to decide what to do about warnings.

If you want to keep it generic, maybe warnings.catch_warnings()?

@pllim
Copy link
Contributor

pllim commented Jan 9, 2025

For error, a generic try ... except ... would work but keep in mind that except gets expensive if hit too often. (And also make things harder to debug in the future.)

@cshanahan1 cshanahan1 merged commit e8510da into spacetelescope:main Jan 9, 2025
19 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

5 participants