-
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
Store 'source' info in KeyBindingRegistry
#207
Comments
source should be immutable. we definitely want to know who contributed a keybinding at registration time and I don't see any need for that to be mutable. i can see a world in which priority is mutable... but that seems like a separate item, and can come later.
no, not different. that is the when clause. That is already available on keybindings. what's not implemented is run-time keybinding lookup based on a context. (keybindings should not be returned from |
Sorry when I say 'source' can be set by the user, I mean the potential 'source' names and their priorities. i.e., maybe instead of the classic user, ext, core, they may want to add a 4th one named 'something else'. Or they want something completely different? I don't know enough about use cases to judge this.
I had not thought about this at all but agree, I'd go with YAGNI for now too.
Thanks! It's on my to do list to make another issue on implementing |
Or I wonder if we don't even bother with 'source' names and just have e.g., 3 sources 'a' > 'b' > 'c' ...? |
what if multiple plugins register the same keybinding? how do you plan on picking?
I do think that |
Sounds good. And would you want to let the user amend these source names?
Yup thats a good question. Kira sorted keybindings in the registry by weight, then their registration order. This was meant to make I wasn't thinking of exposing
I guess in the context of |
lets start with no, add later if needed
i haven't been following what happened in the napari dispatcher. my original intention for keybinding lookup was this:
|
Kira added a keymap to her keybinding registry, of format: {key sequence: [key binding entries]} and sorted on weight (meat of it is here in case you are interested) I like the key map idea at least as it means you don't need to loop through all the keybindings to find the entries with a specific key sequence. WDYT? |
yep, a reverse index is definitely going to be useful here. Actually, I'm remembering now that |
Will open a new issue with a proposal for this soon(ish)! |
Enable
KeyBindingRegistry
to store information on the 'source' of the keybinding e.g., whether user, extension or core set the keybinding. Sources will have priority order e.g., user > ext > coreI am not sure whether the source options are immutable, set to be user > ext > core , or if we allow the user to specify 'source' and their priority order. In the latter case we could default to user > ext > core. WDYT @tlambert03 @DragaDoncila ?
@tlambert03 is this different from
KeyBindingRule
swhen
(which currently is not implemented)?Migrated from discussion in #177
The text was updated successfully, but these errors were encountered: