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
Use app-model keybindings internally #5103
Conversation
If we touch this, maybe remove the strict key bind for actions and allow configuring it through preferences? |
81b021c
to
d473ebd
Compare
what are you referring to exactly? i may address this in a future PR |
For most actions we define shortcuts here: and in proper files we define only Actions: napari/napari/layers/labels/_labels_key_bindings.py Lines 47 to 49 in 31ee236
And this allows to set actions shortcuts to personal preferences: So as we touch this, we may want to stop using hardcoded shortcuts. |
ah, thank you for pointing this out! ill replace those with |
8e13c6d
to
fbcce7f
Compare
else: | ||
# Shift is consumed to transform key | ||
|
||
# bug found on OSX: Command will cause Shift to not |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
can you add a few test cases to show this?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
this is deleted code that was re-added. i dont know a good way to test this and i dont think its worth my time since the code for handling this will change in the next PR i work on related to handling keypress events
Click here to download the docs artifacts |
Click here to download the docs artifacts |
fa1162a
to
bebdf30
Compare
Codecov Report
@@ Coverage Diff @@
## main #5103 +/- ##
==========================================
+ Coverage 88.76% 88.77% +0.01%
==========================================
Files 579 579
Lines 49093 49109 +16
==========================================
+ Hits 43576 43597 +21
+ Misses 5517 5512 -5
Help us with your feedback. Take ten seconds to tell us how you rate us. Have a feature suggestion? Share it here. |
Click here to download the docs artifacts |
@kne42 can you take a look at the failed tests? thanks! |
There's an issue serializing As a workaround, it looks like we'll need to implement |
I can't say I completely understand the issue but I do see this: In [4]: KeyBinding.from_str('ctrl-c').json()
Out[4]: '{"parts": [{"ctrl": true, "shift": false, "alt": false, "meta": false, "key": 20}]}'
In [5]: KeyBinding.from_str('ctrl-c').dict()
Out[5]:
{'parts': [{'ctrl': True,
'shift': False,
'alt': False,
'meta': False,
'key': <KeyCode.KeyC: 20>}]} I suspect we need to add |
bebdf30
to
2a7ed66
Compare
tests work on my machine with the version of |
1434d17
to
1cf54f3
Compare
1cf54f3
to
7b60f46
Compare
ppl were not in favour of the custom root type solution i proposed so we put a hack in here, enjoy |
6adf0c5
to
18c8693
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Few comments from fast review
f6071a1
to
835a42b
Compare
# Description This PR restores the `V` keybinding for toggling the visibility of the currently selected layers. It looks like this was unintentionally changed in #5103. I'm pretty sure it's unintentional because the PR description talks about changing the internal representation, not the user interaction. Also, the line above the one affected also contains `KeyCode.KeyG]`, so I think that it was copy-pasted as a template for the line below it, which was then only partially edited by mistake. # References and relevant issues https://github.com/napari/napari/blob/bf211d7c8c5582c0fe8cc8a09a9e51f31a230e5c/napari/utils/shortcuts.py#L23 ``` 'napari:toggle_selected_visibility': [KeyCode.KeyG], ``` Reference: #5103
Description
Converts the internal representation of keybindings from strings to
app-model
'sKeyBinding
.see #4860