From 23caa796aefe9338c54de4e7038b432889c31854 Mon Sep 17 00:00:00 2001 From: school510587 Date: Thu, 19 Sep 2024 13:59:02 +0800 Subject: [PATCH] Correct internal gesture ID for Seika Notetaker (#17047) Fixes issue 3 of #16828 . Summary of the issue: The br(seikantk):XXX IDs of bk:space and bk:space+dots are incorrect. Although it has few influence to UX, it may bring trouble to add-on developers. Description of user facing changes There must be one option displayed when adding a new gesture in Input gestures dialog is about Seika Notetaker. Without this PR, the option is always backspace+dX, e.g. backspace+d1+d3+d4+d5. Now, backspace+d1+d3+d4+d5, d1+d3+d4+d5+space, and backspace+d1+d3+d4+d5+space are displayed correctly according to the actual space key(s) pressed by the user. Description of development approach Type of space parameter of class InputGesture becomes int. It may be 1(backspace), 2(space), or 3(both). The correct key name is obtained from _getKeyNames. --- source/brailleDisplayDrivers/seikantk.py | 12 ++++++------ user_docs/en/changes.md | 2 ++ 2 files changed, 8 insertions(+), 6 deletions(-) diff --git a/source/brailleDisplayDrivers/seikantk.py b/source/brailleDisplayDrivers/seikantk.py index c673386eeb8..28beb399ae2 100644 --- a/source/brailleDisplayDrivers/seikantk.py +++ b/source/brailleDisplayDrivers/seikantk.py @@ -308,13 +308,13 @@ def _handleKeys(self, arg: bytes): gestures = [] if brailleDots: if key in (1, 2, 3): # bk:space+dots + gestures.append(InputGesture(dots=brailleDots, space=key)) key = 0 - gestures.append(InputGesture(dots=brailleDots, space=True)) else: # bk:dots - gestures.append(InputGesture(dots=brailleDots, space=False)) + gestures.append(InputGesture(dots=brailleDots, space=0)) if key: if key in (1, 2): # bk:space - gestures.append(InputGesture(dots=0, space=True)) + gestures.append(InputGesture(dots=0, space=key)) else: # br(seikantk):XXX gestures.append(InputGesture(keys=key)) for gesture in gestures: @@ -391,7 +391,7 @@ def _getRoutingIndexes(routingKeyBytes: bytes) -> Set[int]: class InputGesture(braille.BrailleDisplayGesture, brailleInput.BrailleInputGesture): source = BrailleDisplayDriver.name - def __init__(self, keys=None, dots=None, space=False, routing=None): + def __init__(self, keys=None, dots=None, space=0, routing=None): super(braille.BrailleDisplayGesture, self).__init__() # see what thumb keys are pressed: names = set() @@ -400,8 +400,8 @@ def __init__(self, keys=None, dots=None, space=False, routing=None): elif dots is not None: self.dots = dots if space: - self.space = space - names.add(_keyNames[1]) + self.space = bool(space) + names.update(_getKeyNames(space, _keyNames)) names.update(_getKeyNames(dots, _dotNames)) elif routing is not None: self.routingIndex = routing diff --git a/user_docs/en/changes.md b/user_docs/en/changes.md index c75bbc1c61a..8022136dff6 100644 --- a/user_docs/en/changes.md +++ b/user_docs/en/changes.md @@ -34,6 +34,7 @@ In order to use this feature, the application volume adjuster needs to be enable * Improvements when editing in Microsoft PowerPoint: * Caret reporting no longer breaks when text contains wide characters, such as emoji. (#17006 , @LeonarddeR) * Character location reporting is now accurate (e.g. when pressing `NVDA+Delete`. (#9941, @LeonarddeR) +* When using the Seika Notetaker, space and space with dots gestures are now displayed correctly in the Input Gestures dialog. (#17047, @school510587) * Configuration profiles: * Braille is no longer dysfunctional when activating 'say all' with an associated configuration profile. (#17163, @LeonarddeR) * Fixed an issue where certain settings were explicitly saved to the active configuration profile even when the value of that setting was equal to the value in the base configuration. (#17157, @leonarddeR) @@ -72,6 +73,7 @@ As the Add-on Store base URL is now configurable directly within NVDA, no replac * The following symbols in `appModules.soffice` have been renamed (#6915, @michaelweghorn): * `SymphonyDocument.announceToolbarButtonToggle` to `SymphonyDocument.announceFormattingGestureChange` * `SymphonyDocument.script_toggleTextAttribute` to `SymphonyDocument.script_changeTextFormatting` +* The `space` keyword argument for `brailleDisplayDrivers.seikantk.InputGesture` now expects an `int` rather than a `bool`. (#17047, @school510587) * The `[upgrade]` configuration section including `[upgrade][newLaptopKeyboardLayout]` has been removed. (#17191) #### Deprecations