8000 Select shortcut shift by mstabrin · Pull Request #5021 · napari/napari · GitHub
[go: up one dir, main page]
More Web Proxy on the site http://driver.im/
Skip to content

Select shortcut shift #5021

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

Open
wants to merge 15 commits into
base: main
Choose a base branch
from
Open

Conversation

mstabrin
Copy link
Contributor
@mstabrin mstabrin commented Sep 6, 2022 8000

Description

Based on the previous discussion, the functionality asked for in #5013 is already present :)
However, I propose some layout change to make it less confusing:

Points, Shapes, and Labels might be used in the same project multiple times.
However, their shortcuts for Select and delete are not identical:
Select(3) in Points is Delete(3) in Shapes
Which immediately lead to a loss of data points via testing.
Therefore, I propose that the shortcuts for Delete(1) and Select(2) are identical in both layers.

I also reflected this in the order of the RadioButtons, but I am also fine by just adjusting the shortcut to keep the visual grouping of functionality rather then reflecting the order of the shortcuts.

Additionally, it seems that the functionality of the visual representation of the shortcuts in the tooltips was already there, but was missing a call to the update function.
I also added information about the toggle option to those buttons.

Type of change

  • New feature (non-breaking change which adds functionality)

References

#5013

@mstabrin mstabrin mentioned this pull request Sep 6, 2022
2 tasks
@github-actions github-actions bot added the qt Relates to qt label Sep 6, 2022
@codecov
Copy link
codecov bot commented Sep 6, 2022

Codecov Report

All modified and coverable lines are covered by tests ✅

Project coverage is 88.78%. Comparing base (6ba16c1) to head (272dc29).
Report is 1068 commits behind head on main.

Additional details and impacted files
@@            Coverage Diff             @@
##             main    #5021      +/-   ##
==========================================
- Coverage   88.84%   88.78%   -0.06%     
==========================================
  Files         579      579              
  Lines       49109    49116       +7     
==========================================
- Hits        43629    43609      -20     
- Misses       5480     5507      +27     

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

Copy link
Collaborator
@Czaki Czaki left a comment

Choose a reason for hiding this comment

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

I like the main idea of this PR, but do not like multiple repetitions of extra_tooltip_text as it is an additional thing to be maintained.

I prefer to have some generic solution. For example, inspect the action to check if it support Hold shortcut to temporarily activate. Or at least export these strings to some function (not global variable as trans need to be supported) to not repeat the same string multiple times that may introduce some problem in further refactoring.

Copy link
Collaborator
@Czaki Czaki left a comment

Choose a reason for hiding this comment

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

change to comment

@Czaki Czaki self-requested a review September 6, 2022 08:02
Copy link
Contributor
@brisvag brisvag left a comment

Choose a reason for hiding this comment

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

Good idea to unify the behaviours. I think we should prioritize mnemonics (order in GUI matches order of shortcuts) rather than aesthetics (order by category).

To be honest, I think the best solution would be to have letters rather than numbers (d for delete and so on), but I wasn't there when numbers were chosen in the first place. @jni?

I agree with @Czaki on the maintainability, we should find a more general way of adding the tooltips.

Either way, I think this should wait 0.5 to be merged, because it breaks quite prominent shortcuts.

@psobolewskiPhD
Copy link
Member
psobolewskiPhD commented Sep 6, 2022

This excellent PR from @Czaki will help a lot in terms of allowing sane defaults (numbers and letters?) and allowing the user to make their own.
#5018

@alisterburt
Copy link
Contributor
alisterburt commented Sep 6, 2022

Thanks again @mstabrin - you're on fire!! 🔥 🚒

To be honest, I think the best solution would be to have letters rather than numbers (d for delete and so on), but I wasn't there when numbers were chosen in the first place. @jni?

For what it's worth they used to be letters but it was decided the ergonomics weren't great for keyboard users (@haesleinhuepf suggested, IIRC) so we switched to the top row of numbers. With @Czaki's recent PR #5018 we can better support multiple, configurable shortcuts so maybe having both is a better long term solution

edit: the letters as shortcuts are also only meaningful in our language, which isn't ideal but maybe not a dealbreaker? @LCObus do you have insight here?

@haesleinhuepf
Copy link
Contributor

To be honest, I think the best solution would be to have letters rather than numbers (d for delete and so on), but I wasn't there when numbers were chosen in the first place. @jni?

For what it's worth they used to be letters but it was decided the ergonomics weren't great for keyboard users (@haesleinhuepf suggested, IIRC)

Yes, you can read in #2800 why I proposed that. TL:DR: Ergonomy. When changing it again, please make sure users can annotate things for hours without breaking their fingers on the keyboard.

@brisvag
Copy link
Contributor
brisvag commented Sep 6, 2022

Yes, you can read in #2800 why I proposed that. TL:DR: Ergonomy. When changing it again, please make sure users can annotate things for hours without breaking their fingers on the keyboard.

You're totally right, we should keep the numbers. So, to get back on topic, I suggest we ensure shortcut numbers and order of buttons in the GUI match, and leave the possible extra shortcuts with #5018 to a later date.

edit: the letters as shortcuts are also only meaningful in our language, which isn't ideal but maybe not a dealbreaker? @LCObus do you have insight here?

I don't think that would be a big deal (most of the docs and tutorials will likely be in english), but maybe we can localize those as well? :P

@mstabrin
Copy link
Contributor Author
mstabrin commented Sep 6, 2022

I really like the idea of generalization of the tooltip and tried to automatically detect if a button is toggable by holding it, but until now I was unable to do so :(

@mstabrin
Copy link
Contributor Author
mstabrin commented Sep 6, 2022

I tried copying the release_key function, which handles the toggling, but unfortunately could not make it work that way. Will do the function way of things.

@Czaki
Copy link
Collaborator
Czaki commented Sep 6, 2022

I really like the idea of generalization of the tooltip and tried to automatically detect if a button is toggable by holding it, but until now I was unable to do so :(

all current methods with behavior "short click to change, hold to temporary activate" are done using napari.utils.layer_utils.register_layer_attr_action function
In this function, a special attribute could be set to discover that action has this property.

@mstabrin
Copy link
Contributor Author
mstabrin commented Sep 6, 2022

@Czaki Thank you for pointing me in the right direction :) I added it now as an attribute to the Action class.

@LCObus
Copy link
Contributor
LCObus commented Sep 6, 2022

+1 to ergonometry as the best reason to start with numbers.
Depending on how many shortcuts you scale to, you may well end up using letters as well. @alisterburt, while language considerations for accessibility is super thoughtful here, they may not map to the meaning by then, and you could employ the same ergonomic rationale (start with usage of QWERTY or ASDF, or SHIFT/ALT +1) Better to standardize a process then try to fit to letters (which will break semantically pretty quickly- even our "copy+paste" uses "v" which, doesnt make sense?)

@psobolewskiPhD
Copy link
Member
psobolewskiPhD commented Sep 7, 2022

Finally had a chance to play with this—really dig this PR. Once #5018 goes in it will be pure 🔥.
While we're making icon order more logical, perhaps Labels should be tweaked too?
At present:
image
By the order logic, 1 should be the swap labels, but for consistency it's on erase--equivalent to delete, etc. So the swap labels icon should probably be next to/after the picker icon? I would say those two functions are related.
Here's my proposal (made a PR to your branch @mstabrin). This keeps 1-5 consistent.
image

@alisterburt alisterburt added this to the 0.5 milestone Sep 8, 2022
@andy-sweet
Copy link
Member

Thanks for the work here @mstabrin! Could you merge main with this and push? Then one of the existing reviewers should be able to get this merged.

@psobolewskiPhD
Copy link
Member

Just want to note that PR should close #3133

@jni jni added the ui change label Oct 23, 2022
@jni
Copy link
Member
jni commented Oct 23, 2022

Side note: @Czaki does the release script use the "ui change" label? I think it's important to note things like moving buttons in release notes.

@Czaki
Copy link
Collaborator
Czaki commented Oct 23, 2022

Side note: @Czaki does the release script use the "ui change" label? I think it's important to note things like moving buttons in release notes.

nope: https://github.com/napari/docs/blob/f090a96de95ac4ecb826707c88328ebebf1f2fc4/docs/release/generate_release_notes.py#L223

But when I introduced it, I wrote that list of labels should be reviewed and adjusted.

Also would like to link: #5140

@mstabrin
Copy link
Contributor Author

I merged the main branch and adjusted the code accordingly :)

@mstabrin
Copy link
Contributor Author

I have some tests failing locally, but the same tests also fail on the main branch, so I am not sure what to do about it :)

@psobolewskiPhD
Copy link
Member

Can you clarify which tests are failing for you locally?

@mstabrin
Copy link
Contributor Author

@psobolewskiPhD It appears it was due to some cluttering of the python environment.

@psobolewskiPhD
Copy link
Member

@psobolewskiPhD It appears it was due to some cluttering of the python environment.

Ok. The CI macOS fail seems like the Pint 0.20 fail:
#5265 (comment)
A fix has been merged upstream, so then Pint 0.20.1 is released I think it will be resolved.

@Czaki Czaki mentioned this pull request Oct 27, 2022
12 tasks
@Czaki
Copy link
Collaborator
Czaki commented Oct 27, 2022

Pint 0.20.1 released.

@psobolewskiPhD
Copy link
Member

@mstabrin I was testing this today and noticed that 1 doesn't work as the x button for shapes and points. Looking at the code, those buttons have delete, backspace, and 1 specified, in that order. But napari only supports 2 keybinds. (there is an issue for arbitrary number of keybinds: #5046)
My suggestion would be to make it say 1 and then backspace, so the default functionality works as for Labels.

@psobolewskiPhD
Copy link
Member

@mstabrin
Gentle bump
If you have time and interest in getting this over the line, perhaps you could update the OP and resolve conflicts? Some screenshots of the new toolbars could help!

@jni related to the new polygons tools discussion: this PR would change existing icon-keybinding relation, but harmonize between layers. Obviously existing users might have workflows affected, but the harmonization lowers barriers to entry and makes it easier going forward.

@mstabrin
Copy link
Contributor Author

Hey @psobolewskiPhD,

Thanks for the reminder, I was out of the project for some time.
I will have a look when I have time, but I cannot promise this week, because I am on a trip.

I will see what I can do :)

@psobolewskiPhD
Copy link
Member

@mstabrin
No worries!
If you're busy it's something I can pick up—just let me know.

We've been discussing some aspects related to tools recently, so I was reminded of this PR.
For example a new labels tool: #5806 comment #5806 (comment)
and new Shapes lasso tool:
#5555

We definitely need to give some thought to tools/icons/organization, so it might get re-reviewed from a fresh perspective.

@Czaki
Copy link
Collaborator
Czaki commented Sep 23, 2023

@mstabrin What is your current status? Did you predict that you will be able to come back to PRs, or we could take your PRs to finish them?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
needs:decision Needs a decision to move forward qt Relates to qt ui change
Projects
None yet
Development

Successfully merging this pull request may close these issues.

10 participants
0