Basic support for braille display key modifiers#7503
Conversation
* For example, if L{self.id} is 'key1+key2', key1 is bound to 'kb:control' and key2 to 'kb:tab', this gesture should execute 'kb:control+tab'
* Combining modifiers with braille input (#7306) is not yet supported
| """Retrieves modifier gestures from this display driver's L{gestureMap} | ||
| that are bound to modifier only keyboard emulate scripts. | ||
| @return: the ids of the display keys and the associated generalised modifier names | ||
| @rtype: generator of (set, set) |
There was a problem hiding this comment.
Why sets instead of tuples/lists? Sets have some fancy operator overloads, but that pattern is not used much in NVDA.
There was a problem hiding this comment.
I use sets because of these operator overloads.
| gestureKeys = set(self.keyNames) | ||
| gestureModifiers = set() | ||
| for keys, modifiers in handler.display._getModifierGestures(): | ||
| if keys<gestureKeys: |
There was a problem hiding this comment.
@dkager: see this line and lines below, which contain some set operator stuff.
There was a problem hiding this comment.
I assume < means "subset of", but I'm not sure. That's why I am wondering if the benefit of overloaded operators is really a benefit.
| for globalMap in globalMaps: | ||
| for scriptCls, gesture, scriptName in globalMap.getScriptsForAllGestures(): | ||
| if gesture.startswith("br({source})".format(source=cls.name)) and scriptCls is globalCommands.GlobalCommands and scriptName.startswith("kb"): | ||
| script = scriptHandler._makeKbEmulateScript(scriptName) |
There was a problem hiding this comment.
For ease of understanding, I think I'd prefer either calling keyboardHandler.KeyboardInputGesture.fromName(keyName) directly here, or adding a scriptHandler._makeKbEmulateGesture that is called from both here and scriptHandler._makeKbEmulateScript
| # __name__ must be str; i.e. can't be unicode. | ||
| scriptName = scriptName.encode("mbcs") | ||
| func.__name__ = "script_%s" % scriptName | ||
| func.emuGesture = emuGesture |
There was a problem hiding this comment.
I don't think this is needed anymore?
|
Is this ready to be incubated? |
|
Sure. |
|
@LeonarddeR: could you please come up with an entry for the changes for developers section of what's new? Then I can merge this to master. Something referring to the fact it is no longer necessary to bind individual key combinations in braille display drivers... |
|
I usually do not provide changes entries as my English grammar is not what it should be, but I will be more complete for new pull requests. How about the following:
|
|
Looks good, thank you :)
|
Link to issue number:
Fixes #6213
Description
This adds basic support for modifiers in braille display gestures that emulate keyboard gestures. For example, if you have baum key b10 assigned to kb:control and you combine b10 with the joystick found on baum displays, you will be able to perform keystrokes like control+upArrow, control+downArrow, etc. without explicitly defining them.
Testing performed:
Tested the example as noted above.
Known issues with pull request: