Skip to content

Multi select masks#1849

Merged
bnmajor merged 8 commits intomasterfrom
multi-select-masks
Jun 5, 2025
Merged

Multi select masks#1849
bnmajor merged 8 commits intomasterfrom
multi-select-masks

Conversation

@bnmajor
Copy link
Collaborator

@bnmajor bnmajor commented May 9, 2025

This PR:

  • Rearranges the buttons to try to provide a more intuitive layout
  • Add support for multi-select in the tree view (CTRL + left-click to select individual items, SHIFT + left-click at start and SHIFT + left-click at end to select all items in between)
  • Can use CTRL + a to select all
  • Allows changing the presentation of multiple masks at once
    • If more than one row is selected the combobox on the right will be enabled
    • If one or more of the selected masks are powder, laue, or threshold the options will be limited to None or Visible. Otherwise the Boundary only and Visible + Boundary will also be options.
    • The changes are applied to all selected masks immediately
  • Adds a button to export selected masks
    • This is functionally the same as selecting multiple rows and using the context menu to export, just provides the option of a button if that is preferred over right-click
    • The button is only enabled when more than one row is selected
  • Adds the option to remove multiple masks at a time

image

Fixes #1846

@bnmajor bnmajor force-pushed the multi-select-masks branch 4 times, most recently from 92badcc to 1db5c3d Compare May 13, 2025 21:34
@bnmajor bnmajor marked this pull request as ready for review May 13, 2025 21:35
@bnmajor bnmajor force-pushed the multi-select-masks branch from 1db5c3d to 5ed1740 Compare May 14, 2025 19:59
@bnmajor bnmajor requested review from psavery and saransh13 May 14, 2025 20:00
@bnmajor bnmajor force-pushed the multi-select-masks branch from 5ed1740 to 094aa6e Compare May 14, 2025 20:01
Copy link
Collaborator

@psavery psavery left a comment

Choose a reason for hiding this comment

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

I wonder if we can just get rid of the "Remove Mask" buttons on each row, and rely on the "Remove Selected" instead. What do you think, @saransh13?

Overall, the code changes look good to me! Let us know what you think, Saransh.

selected = self.ui.masks_tree.selectedItems()
self.ui.presentation_selector.setEnabled(len(selected) > 1)
self.ui.export_selected.setEnabled(len(selected) > 1)
self.ui.remove_selected.setEnabled(len(selected) > 1)
Copy link
Collaborator

Choose a reason for hiding this comment

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

I would typically do something like this:

        enable = len(selected) > 1
        widgets = [
            self.ui.presentation_selector,
            self.ui.export_selected,
            self.ui.remove_selected,
        ]
        for w in widgets:
            w.setEnabled(enable)

But you do not have to change it!

bnmajor added 8 commits May 29, 2025 12:24
Export all masks when the context menu is used and multiple masks are selected.

Signed-off-by: Brianna Major <brianna.major@kitware.com>
Signed-off-by: Brianna Major <brianna.major@kitware.com>
- If more than one row is selected the combobox on the right will be enabled
- If one or more of the selected masks are powder, laue, or threshold the
  options will be limited to "None" or "Visible". Otherwise the "Boundary only"
  and "Visible + Boundary" will also be options.
- The changes are applied to all selected masks immediately

Signed-off-by: Brianna Major <brianna.major@kitware.com>
- This is functionally the same as selecting multiple rows and using the
  context menu to export, just provides the option of a button if that is
  preferred over right-click
- The button is only enabled when more than one row is selected

Signed-off-by: Brianna Major <brianna.major@kitware.com>
Signed-off-by: Brianna Major <brianna.major@kitware.com>
Signed-off-by: Brianna Major <brianna.major@kitware.com>
Signed-off-by: Brianna Major <brianna.major@kitware.com>
Signed-off-by: Brianna Major <brianna.major@kitware.com>
@bnmajor bnmajor force-pushed the multi-select-masks branch from 094aa6e to 6779d71 Compare May 29, 2025 16:49
@bnmajor bnmajor mentioned this pull request May 30, 2025
Copy link
Member

@saransh13 saransh13 left a comment

Choose a reason for hiding this comment

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

I'm approving the PR but will note that the mask to panel buffer is not working as expected. Since this is also a problem in master, we can fix that issue in a follow up PR.

@bnmajor bnmajor merged commit 47c8476 into master Jun 5, 2025
9 checks passed
@bnmajor bnmajor deleted the multi-select-masks branch June 5, 2025 12:32
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.

Allow multi-select in mask manager

3 participants