-
-
Notifications
You must be signed in to change notification settings - Fork 654
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
NLS eReader Zoomax braille driver #17509
base: master
Are you sure you want to change the base?
Conversation
Thanks for opening this PR @florin-trutiu !
|
pre-commit.ci autofix |
@seanbudd In the user guide I have now added a section for the NLS eReader Zoomax braille display. |
@florin-trutiu, you have added the template, but for completeness, could you please writing the required information in its sections rather than writing before it? Thanks! |
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 for submitting this, @florin-trutiu! A lot of questions and stylistic questions on this to begin with
# -*- coding: UTF-8 -*- | ||
# brailleDisplayDrivers/nlseReaderZoomax.py | ||
# Description: | ||
# NLS eReader Zoomax driver for NVDA. |
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.
Please update this to be in line with the copyright headers in the rest of NVDA's source.
# -*- coding: UTF-8 -*- | |
# brailleDisplayDrivers/nlseReaderZoomax.py | |
# Description: | |
# NLS eReader Zoomax driver for NVDA. | |
# A part of NonVisual Desktop Access (NVDA) | |
# Copyright (C) 2025 NV Access Limited, Florin Trutiu | |
# This file is covered by the GNU General Public License. | |
# See the file COPYING for more details. | |
# NLS eReader Zoomax driver for NVDA. |
# NLS eReader Zoomax driver for NVDA. | ||
|
||
import time | ||
from typing import Union, List, Optional |
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.
Union type expressions are preferred over typing.Union
. Likewise, T | None
is preferred over typing.Optional[T]
. And typing.List
is a deprecated alias of list
.
from typing import Union, List, Optional | ||
|
||
import braille | ||
from hwIo import intToByte, boolToByte |
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 import hwIo
at line 14.
import bdDetect | ||
import serial | ||
|
||
TIMEOUT = 0.2 |
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.
Please add units.
TIMEOUT = 0.2 | |
TIMEOUT_SEC = 0.2 |
TIMEOUT = 0.2 | ||
BAUD_RATE = 19200 | ||
CONNECT_RETRIES = 5 | ||
TIMEOUT_BETWEEN_RETRIES = 2 |
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.
Please add units
TIMEOUT_BETWEEN_RETRIES = 2 | |
TIMEOUT_BETWEEN_RETRIES_SEC = 2 |
if not isinstance(command, bytes): | ||
raise TypeError(typeErrorString.format("command", "bytes", type(command).__name__)) | ||
|
||
arg = arg.replace(ESCAPE, ESCAPE * 2) |
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.
Can you please explain why you are doing this?
|
||
def _onReceive(self, data: bytes): | ||
if data != ESCAPE: | ||
log.debugWarning("Ignoring byte before escape: %r" % data) |
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.
Please use an f-string instead
# If not, we wish to know about it, allow decode to raise. | ||
self._deviceID = arg.decode("latin-1", errors="strict") | ||
elif command in KEY_NAMES: | ||
arg = sum(byte << offset * 8 for offset, byte in enumerate(arg)) |
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.
Why not
arg = sum(byte << offset * 8 for offset, byte in enumerate(arg)) | |
arg = int.from_bytes(reversed(arg)) |
if arg < self._keysDown.get(command, 0): | ||
# Release. | ||
if not self._ignoreKeyReleases: | ||
# The first key released executes the key combination. | ||
try: | ||
inputCore.manager.executeGesture(InputGesture(self._deviceID, self._keysDown)) | ||
except inputCore.NoInputGestureAction: | ||
pass | ||
# Any further releases are just the rest of the keys in the combination being released, | ||
# so they should be ignored. | ||
self._ignoreKeyReleases = True | ||
else: | ||
# Press. | ||
# This begins a new key combination. | ||
self._ignoreKeyReleases = False | ||
if arg > 0: | ||
self._keysDown[command] = arg | ||
elif command in self._keysDown: | ||
# All keys in this group have been released. | ||
# #3541: Remove this group so it doesn't count as a group with keys down. | ||
del self._keysDown[command] |
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'm having a lot of trouble following what's going on here. Could you please comment a bit more on what's going on?
|
||
self.keyNames = names = [] | ||
for group, groupKeysDown in keysDown.items(): | ||
if group == LOC_BRAILLE_KEYS and len(keysDown) == 1 and not groupKeysDown & 0xF8: |
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.
Why 0xf8
?
user_docs/en/changes.md
Outdated
@@ -27,6 +27,7 @@ To use this feature, "allow NVDA to control the volume of other applications" mu | |||
* Automatic language switching is now supported when using Microsoft Speech API version 5 (SAPI5) and Microsoft Speech Platform voices. (#17146, @gexgd0419) | |||
* NVDA can now be configured to speak the current line or paragraph when navigating with braille navigation keys. (#17053, @nvdaes) | |||
* In Word, the selection update is now reported when using Word commands to extend or reduce the selection (`f8` or `shift+f8`). (#3293, @CyrilleB79) | |||
* NLS eReader Zoomax driver has been added. Previously it was available only as a separate addon. |
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.
* NLS eReader Zoomax driver has been added. Previously it was available only as a separate addon. | |
* Support for the NLS eReader Zoomax braille display has been added. (#17509, @florin-trutiu) |
user_docs/en/userGuide.md
Outdated
|
||
The NLS eReader Zoomax device supports USB or bluetooth connections. | ||
The Windows 10 and Windows 11 operating systems will automatically detect and install the necessary drivers for this display. | ||
For computers where the Internet connection is disabled or not available, for the USB connection, a driver can be download from the USB to serial CH340 chip manufacturer (https://www.wch-ic.com/downloads/CH341SER_EXE.html) |
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.
For computers where the Internet connection is disabled or not available, for the USB connection, a driver can be download from the USB to serial CH340 chip manufacturer (https://www.wch-ic.com/downloads/CH341SER_EXE.html) | |
For computers where the Internet connection is disabled or not available, you can manually [download and install the USB to serial CH340 chip driver](https://www.wch-ic.com/downloads/CH341SER_EXE.html) to support this display over USB. |
Link to issue number:
Closes #15863
Summary of the issue:
This is the NVDA driver for the NLS eReader Zoomax braille display.
It supports both USB and Bluetooth automatic detection.
Description of user facing changes
With this driver the user can use directly the NLS eReader Zoomax display without the need to manually install it as an addon.
Description of development approach
The driver is similar with the existing braille display drivers for NVDA.
Testing strategy:
Known issues with pull request:
Code Review Checklist:
@coderabbitai summary