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
BrailleNote: support for QT and Apex BT scroll wheel #6316
Conversation
…ss#5992. Somehow, forgot to check that Rui used a tuple to specify key assignments. Now utilized properly to assign multiple gestures to a command. Also took this time to add codes for various QT keys so NVDA can properly recognize them.
Thanks for your work. I have a few overall questions/concerns about this first before I do a formal review. Keyboard EmulationIs your intention to support keyboard emulation, but you weren't able to manage this yet? Or is there any reason you don't want to support this? Supporting that will require a change to the approach you're using. I think it might be worth considering that now, rather than having to do a major refactor later. Following are some thoughts on that. Rather than emitting BrailleNote gestures and mapping them to key presses, I think it'd be simpler to just emit most keys as KeyboardInputGestures. The QT keys are actually Windows vk codes. So, for most key presses, you would do the following:
For most keys involving the QT function or read modifiers, you'd still want to produce BrailleNote specific gestures as you do now, as these are specific to the BrailleNote. To convert the vk code to a name, you can use KeyboardInputGesture.getVkName. You might want to map control+read to the Windows key and then just treat it as a KeyboardInputGesture as above. Handling Key PacketsAt present, you read the extra bytes for QT_MOD_TAG in _readKeys. I suggest moving this to _readPacket, as this is where "reading" is done. Also, data is really just a second argument, so perhaps call it arg2. |
Hi,
Thanks. |
I'd have readPacket return three values, with the third being None for most commands except the QT modifier command.
Yes, control mode and input mode according to the protocol documentation. I don't quite understand the point of input mode, though, because control mode also provides key presses. if anything, control mode is actually more "raw"; it gives you real modifiers. From what I've read, Window-Eyes allows QWERTY input in both, whereas JAWS only allows QWERTY input in input mode.
I wouldn't worry about serving as an example. If you don't feel this is appropriate, don't do it; it was just a suggestion because I thought people might like to be able to type. Different QWERTY notetakers do things differently anyway. For example, Papenmeier actually passes entirely raw key presses, right down to key ups and key downs for modifiers, whereas BrailleNote does special handling for modifiers. |
…nvaccess#5992 Comment from Jamie Teh (Nv Access): there's no need to call read packet again if we're dealing with QT, so handle this from read packet directly. Thus readPacket returns three things: command, arg (dot mask on BT/command for QT), arg2 (char from QT).
Instead of relying on a dedicated QT key parser, handle parsing directly in readPacket. Also simplifies gesture ID assignment, as the packet will tell the gesture constructor as to what key it is.
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.
Thanks!
Did you decide against doing QWERTY emulation and mapping vk codes using the existing KeyboardInputGesture
stuff as I suggested? If so, that's fine, but be aware that emulation will require a significant refactor later.
if command == QT_MOD_TAG: | ||
key = self._serial.read(2)[-1] | ||
arg2 = _qtKeys[ord(key)] if ord(key) in _qtKeys else key | ||
else: |
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.
You could simplify this to: arg2 = _qtKeys.get(ord(key), key)
|
||
# Data is invoked if we're dealing with a BrailleNote QT. | ||
def _dispatch(self, command, arg, data=None): | ||
def _dispatch(self, command, arg, arg2=None): |
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.
data
-> arg2
. Also, maybe passed
instead of invoked
?
if self.qt: | ||
self.id = qtData if qtMod == 0 else "+".join(("+".join(names), qtData)) | ||
else: |
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.
Gesture identifiers actually must be in Python set order; you can't reorder things. Otherwise, they might not match gesture maps. If you want to reorder them for display reasons, you will need to override displayName
and logIdentifier
. If you want to do that, you'll need a helper method which all of them call which returns the names in the correct order (list not set).
user_docs/en/userGuide.t2t
Outdated
@@ -2093,6 +2100,39 @@ Please check your BrailleNote's documentation to find where these keys are locat | |||
| Windows key | space+dot2+dot4+dot5+dot6 (space+w) | | |||
| Alt key | space+dot1+dot3+dot4 (space+m) | | |||
| Toggle input help | space+dot2+dot3+dot6 (space+lower h) | | |||
|
|||
Following are commands assigned to BrailleNote QT. | |||
%kc:beginInclude |
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.
- A kc include block was already started earlier.
- You probably want to include the sentence explaining the purpose of each table in the kc document anyway, so just leave the kc include block open from before.
- Should the braille dot commands be split out of the main commands into a separate table, since I assume you can't execute those on a QT?
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.
You can ask QT to emulate braille dots by pressing a key (it's a toggle). I can clarify this.
user_docs/en/userGuide.t2t
Outdated
| Toggle input help | read+1 | | ||
|
||
Following are commands assigned to the scroll wheel: | ||
%kc:beginInclude |
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.
See above re kc include block.
user_docs/en/userGuide.t2t
Outdated
%kc:beginInclude | ||
|| Name | Key | | ||
| NvDA menu | read+n | | ||
| Up arrow key | up arrow | |
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.
The convention in NVDA is normally to write keys in camel case; e.g. downArrow instead of down arrow.
…onary key lookup. re nvaccess#5993 A tip from Jamie Teh (NV Access0: use dict.get to simplify the turnary operation. Also, BNQT ticket is 5993, not 5992, and correct comment text.
Review from Jamie Teh (NV Access): * QT can emulate a BrailleNote BT, hence clarify this. * Removed redundant kcinclude statement.
… gesture identifier right. nvaccess#5993 Comment from Jamie Teh (NV Access): use sets instead of turning that into a list just for formatting purposes (and turns out this is unnecessary).
This has now merge conflicts since this driver is hwIo based. |
Hi, looks like I need to do a complete rebase. Thanks for telling me about this – will get to it next week (busy this weekend).
From: Leonard de Ruijter [mailto:notifications@github.com]
Sent: Wednesday, November 8, 2017 12:21 PM
To: nvaccess/nvda <nvda@noreply.github.com>
Cc: Joseph Lee <joseph.lee22590@gmail.com>; Author <author@noreply.github.com>
Subject: Re: [nvaccess/nvda] BrailleNote: support for QT and Apex BT scroll wheel (#6316)
This has now merge conflicts since this driver is hwIo based.
—
You are receiving this because you authored the thread.
Reply to this email directly, view it on GitHub <#6316 (comment)> , or mute the thread <https://github.com/notifications/unsubscribe-auth/AHgLkHHq3ZUlKbE30XkD0hRJrsseNtSwks5s0g0qgaJpZM4JwRDh> .
|
# Conflicts: # source/appModules/win32calc.py # source/brailleDisplayDrivers/brailleNote.py
@LeonarddeR Would you mind reviewing this when you have a chance? |
@josephsl: Could you please resolve another merge conflict? |
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 very good overall. Apart from the inline comments, could you please also revert the mode switch that occurred for appModules/win32calc.py
@@ -74,13 +84,48 @@ | |||
0 : "space" | |||
} | |||
|
|||
# Scroll wheel components (Apex BT) | |||
_scrWheel = ("wcounterclockwise", "wclockwise", "wup", "wdown", "wleft", "wright", "wcenter") |
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.
To improve consistency, could you rename these to wCounterclockwise, wClockwise, wUp, etc?
186:"semi", | ||
187:"equals", | ||
188:"comma", | ||
189:"hyphen", |
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.
I'd call this dash
187:"equals", | ||
188:"comma", | ||
189:"hyphen", | ||
190:"period", |
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.
I'd call this dot.
189:"hyphen", | ||
190:"period", | ||
191:"slash", | ||
192:"graav", |
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.
I'd call this grave
# Force dot8 here, although it should be already there | ||
arg |= DOT_8 | ||
gesture = InputGesture(dots=arg, space=space) | ||
elif command == QT_MOD_TAG: | ||
# BrailleNote QT | ||
gesture = InputGesture(qtMod=arg, qtData=arg2) |
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.
Have you actually considered making this a keyboardHandler.KeyboardInputGesture?
Hi, I will do so this weekend. Thanks.
From: Leonard de Ruijter <notifications@github.com>
Sent: Wednesday, April 11, 2018 3:02 AM
To: nvaccess/nvda <nvda@noreply.github.com>
Cc: Joseph Lee <joseph.lee22590@gmail.com>; Mention <mention@noreply.github.com>
Subject: Re: [nvaccess/nvda] BrailleNote: support for QT and Apex BT scroll wheel (#6316)
@josephsl <https://github.com/josephsl> : Could you please resolve another merge conflict?
—
You are receiving this because you were mentioned.
Reply to this email directly, view it on GitHub <#6316 (comment)> , or mute the thread <https://github.com/notifications/unsubscribe-auth/AHgLkJ4RSD6fNNJf2cqoZx0rW62IpL55ks5tndSCgaJpZM4JwRDh> .
|
Hi, not exactly, as I haven’t delved far into this. Thanks.
From: Leonard de Ruijter <notifications@github.com>
Sent: Wednesday, April 11, 2018 3:33 AM
To: nvaccess/nvda <nvda@noreply.github.com>
Cc: Joseph Lee <joseph.lee22590@gmail.com>; Mention <mention@noreply.github.com>
Subject: Re: [nvaccess/nvda] BrailleNote: support for QT and Apex BT scroll wheel (#6316)
@LeonarddeR commented on this pull request.
_____
In source/brailleDisplayDrivers/brailleNote.py <#6316 (comment)> :
# Force dot8 here, although it should be already there
arg |= DOT_8
gesture = InputGesture(dots=arg, space=space)
+ elif command == QT_MOD_TAG:
+ # BrailleNote QT
+ gesture = InputGesture(qtMod=arg, qtData=arg2)
Have you actually considered making this a keyboardHandler.KeyboardInputGesture?
—
You are receiving this because you were mentioned.
Reply to this email directly, view it on GitHub <#6316 (review)> , or mute the thread <https://github.com/notifications/unsubscribe-auth/AHgLkI9NNmdmJCo7qmzve3DDwcPQO6mQks5tndvHgaJpZM4JwRDh> .
|
# Conflicts: # user_docs/en/userGuide.t2t
…5992. Commented by Leonard de Ruijter: rename QT key names. Update copyright years.
@josephsl: Were you also intending to fix de mode change for win32calc.py? |
Hi, ah yes, about to do that – chmod. Thanks.
From: Leonard de Ruijter <notifications@github.com>
Sent: Friday, April 13, 2018 4:33 AM
To: nvaccess/nvda <nvda@noreply.github.com>
Cc: Joseph Lee <joseph.lee22590@gmail.com>; Mention <mention@noreply.github.com>
Subject: Re: [nvaccess/nvda] BrailleNote: support for QT and Apex BT scroll wheel (#6316)
@josephsl <https://github.com/josephsl> : Were you also intending to fix de mode change for win32calc.py?
—
You are receiving this because you were mentioned.
Reply to this email directly, view it on GitHub <#6316 (comment)> , or mute the thread <https://github.com/notifications/unsubscribe-auth/AHgLkDPgLk9eO_CC0jIKtXcUt4lQAM37ks5toIzjgaJpZM4JwRDh> .
|
What's the status of this? |
Hi, waiting for 2018.3 development to begin so we can come back to this. Thanks.
From: Derek Riemer <notifications@github.com>
Sent: Sunday, June 10, 2018 1:59 PM
To: nvaccess/nvda <nvda@noreply.github.com>
Cc: Joseph Lee <joseph.lee22590@gmail.com>; Mention <mention@noreply.github.com>
Subject: Re: [nvaccess/nvda] BrailleNote: support for QT and Apex BT scroll wheel (#6316)
What's the status of this?
—
You are receiving this because you were mentioned.
Reply to this email directly, view it on GitHub <#6316 (comment)> , or mute the thread <https://github.com/notifications/unsubscribe-auth/AHgLkKGNWwuNDc2OucAyztVjWKoI0YRoks5t7YidgaJpZM4JwRDh> .
|
This pull request addresses the following issues:
All changes are documented in the user guide.
Suggested what's new:
Category: New features
Added support for BrailleNote QT and Apex BT's scroll wheel when BrailleNote is used as a braille display with NVDA.
Thanks.