-
Notifications
You must be signed in to change notification settings - Fork 13
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
feat: initial exploration for keybinding source addition and inverse map for keybinding registry #226
Conversation
…map for keybinding registry
Codecov ReportAll modified and coverable lines are covered by tests ✅
Additional details and impacted files@@ Coverage Diff @@
## main #226 +/- ##
=========================================
Coverage 100.00% 100.00%
=========================================
Files 31 31
Lines 1883 1916 +33
=========================================
+ Hits 1883 1916 +33 ☔ View full report in Codecov by Sentry. |
I had a look at this and I like the implementation, and sorting first by source, then by weight. The only question that came to mind is whether we think the sources should also be app-configured or whether we think @dalthviz it would be good to update the description to add specifically what is changing namely:
@tlambert03 what do you think about the changes here? Also cc. @lucyleeow |
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.
looks good! made a number of suggestions for cleanup of logic and syntax
src/app_model/types/_constants.py
Outdated
@@ -3,6 +3,14 @@ | |||
from enum import Enum | |||
|
|||
|
|||
class KeyBindingSource(Enum): |
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.
would be a good candidate for IntEnum
, to gain support for rich comparisons
Co-authored-by: Talley Lambert <[email protected]>
Over napari/napari#6204 I think the value is named
Let me know what could be the prefered combination or if providing an option to use a custom set of values/enum makes sense! |
I'm happy to defer to the group opinion/decision here. I like thanks for all this @dalthviz |
Co-authored-by: Draga Doncila Pop <[email protected]>
For the moment then I will follow the naming suggestion done by Draga (last commit changes Thank you for the reviews @tlambert03 @DragaDoncila and let me know if something else is needed here! |
Late to the party but this is great @dalthviz. Great choices, will be nice to use for keybinding implementation in napari. |
Closes #207
Based on napari/napari#6204
Currently this:
source
field and three prioritized sources (USER
,PLUGIN
,SYSTEM
)get_context_prioritized_keybinding
)_keymap
)_keybindings
attribute to be computed from the new_keymap
attribute_RegisteredKeyBinding
comparison logic and the method to retrieve a prioritaized keybinding (get_context_prioritized_keybinding
)