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. 🚀 New features to boost your workflow:
|
|
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 |
tlambert03
left a comment
There was a problem hiding this comment.
looks good! made a number of suggestions for cleanup of logic and syntax
src/app_model/types/_constants.py
Outdated
| from enum import Enum | ||
|
|
||
|
|
||
| class KeyBindingSource(Enum): |
There was a problem hiding this comment.
would be a good candidate for IntEnum, to gain support for rich comparisons
Co-authored-by: Talley Lambert <talley.lambert@gmail.com>
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 <17995243+DragaDoncila@users.noreply.github.com>
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:
sourcefield and three prioritized sources (USER,PLUGIN,SYSTEM)get_context_prioritized_keybinding)_keymap)_keybindingsattribute to be computed from the new_keymapattribute_RegisteredKeyBindingcomparison logic and the method to retrieve a prioritaized keybinding (get_context_prioritized_keybinding)