Skip to content
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

Support custom braille tables #138

Open
sukiletxe opened this issue Oct 6, 2024 · 2 comments
Open

Support custom braille tables #138

sukiletxe opened this issue Oct 6, 2024 · 2 comments

Comments

@sukiletxe
Copy link
Contributor

Hello,
NVDA 2024.3 incorporates the option to add custom tables. When using these tables, Braille Extender stops working and also stops the tables from working. Tested with Experimental braille tables, which copies over the Spanish tables for easier editing

The culprit seems to be the function getCurrentBrailleTables in utils, which is used by many patches. This function only uses brailleTables.TABLES_DIR, which is a constant for the builtin tables. Now, NVDA has more methods to check extra tables: namely, brailleTables._tablesDirs (chainmap, keys are addon names and builtin, values are directories where the tables, both from addons and builtin ones, are stored), listTables (returns a list of BrailleTable objects) and getTable (returns a BrailleTable object from its filename).

I don't know if fixing this function to use these new methods will fix anything, but I found this information, and I hope it will make things easier. Could you please add support for custom tables?

Thanks!

@school510587
Copy link

Hi,

We encounter this problem, too. I'm one of authors of zwxybrl, which is a set of experimental new braille rules for Chinese characters. Our add-on has been sure to successfully run on NVDA 2024.3, but it doesn't work with BrailleExtender. That is, the user cannot select the custom braille output translation table.

The custom braille table is addons\zwxybrl\brailleTables\zwxybrl.ctb under the user configuration directory. The following is an instance of the generated error message:

Traceback (most recent call last):
  File "C:\Users\ah7222\AppData\Roaming\nvda\addons\zwxybrl\globalPlugins\zwxybrl\__init__.py", line 68, in script_quickSwitchWithXYbrl
    ui.message(_("The braille output translation table has been changed to: {0}").format(braille.handler.table.displayName))
  File "ui.pyc", line 151, in message
  File "C:\Users\ah7222\AppData\Roaming\nvda\addons\BrailleExtender\globalPlugins\brailleExtender\speechhistorymode.py", line 137, in newBrailleMessage
    orig_BrailleMessage(self, *args, **kwargs)
  File "braille.pyc", line 2722, in message
  File "C:\Users\ah7222\AppData\Roaming\nvda\addons\BrailleExtender\globalPlugins\brailleExtender\patches.py", line 173, in update_region
    self.brailleCells, self.brailleToRawPos, self.rawToBraillePos, self.brailleCursorPos = louisHelper.translate(
                                                                                           ^^^^^^^^^^^^^^^^^^^^^^
  File "louisHelper.pyc", line 155, in translate
  File "louis\__init__.pyc", line 266, in translate
RuntimeError: Can't translate: tables ['C:\\Users\\ah7222\\AppData\\Roaming\\nvda/brailleExtender\\brailleDicts\\zh-tw.ctb.cti', 'C:\\Users\\ah7222\\AppData\\Roaming\\nvda/brailleExtender\\brailleDicts\\default.cti', 'C:\\Program Files (x86)\\NVDA\\louis\\tables\\zwxybrl.ctb', 'C:\\Program Files (x86)\\NVDA\\louis\\tables\\braille-patterns.cti'], inbuf b'\xde\x9e\x00\x00W[\x00\x008\x8f\x00\x00\xfaQ\x00\x00I\x8f\x00\x00o\x8b\x00\x00h\x88\x00\x00\xf2]\x00\x00\x93}\x00\x009e\x00\x00\x8a\x8b\x00\x00\x10b\x00\x00\x1a\xff\x00\x00-N\x00\x00\x87e\x00\x00b_\x00\x00\xa9\x7f\x00\x00\xde\x9e\x00\x00W[\x00\x00', typeform None, cursorPos c_long(0), mode 4

It fails to resolve C:\Program Files (x86)\NVDA\louis\tables\zwxybrl.ctb

If there is any problem during solving the issue, please don't hesitate to ask us. The zwxybrl add-on is also available here, zwxybrl-24.10.nvda-addon. Thanks.

@school510587
Copy link

school510587 commented Oct 24, 2024

Hi,

We test again using the latest NVDA 2024.1rc1. With BrailleExtender 24.08.30-c684cb6 and zwxybrl enabled, we try to set the braille output translation table to the custom zwxybrl.ctb provided by zwxybrl add-on via the NVDA settings dialog. The LookupError still occurs, and we collect the entire record of events in the attached file. Here is the main error message:

ERROR - louisHelper._resolveTable (16:40:38.504) - MainThread (22220):
Traceback (most recent call last):
  File "louisHelper.pyc", line 93, in _resolveTable
  File "louisHelper.pyc", line 93, in <listcomp>
  File "louisHelper.pyc", line 68, in _resolveTableInner
LookupError: Could not resolve table 'D:\\nvda fresh\\louis\\tables\\zwxybrl.ctb', looked in paths: ['D:\\nvda fresh\\louis\\tables']
ERROR - eventHandler.executeEvent (16:40:38.504) - MainThread (22220):
error executing event: gainFocus on <NVDAObjects.IAccessible.sysListView32.ListItem object at 0x038506F0> with extra args of {}
Traceback (most recent call last):
  File "eventHandler.pyc", line 353, in executeEvent
  File "eventHandler.pyc", line 119, in __init__
  File "eventHandler.pyc", line 128, in next
  File "D:\nvda fresh\userConfig\addons\BrailleExtender\globalPlugins\brailleExtender\__init__.py", line 171, in event_gainFocus
    nextHandler()
  File "eventHandler.pyc", line 128, in next
  File "appModules\nvda.pyc", line 207, in event_gainFocus
  File "eventHandler.pyc", line 128, in next
  File "NVDAObjects\__init__.pyc", line 1366, in event_gainFocus
  File "braille.pyc", line 2771, in handleGainFocus
  File "braille.pyc", line 2781, in _doNewObject
  File "braille.pyc", line 2153, in getFocusContextRegions
  File "D:\nvda fresh\userConfig\addons\BrailleExtender\globalPlugins\brailleExtender\objectpresentation.py", line 156, in update_NVDAObjectRegion
    super(braille.NVDAObjectRegion, self).update()
  File "D:\nvda fresh\userConfig\addons\BrailleExtender\globalPlugins\brailleExtender\patches.py", line 191, in update_region
    self.brailleCells, self.brailleToRawPos, self.rawToBraillePos, self.brailleCursorPos = louisHelper.translate(
                                                                                           ^^^^^^^^^^^^^^^^^^^^^^
  File "louisHelper.pyc", line 155, in translate
  File "louis\__init__.pyc", line 266, in translate
RuntimeError: Can't translate: tables ['D:\\nvda fresh\\louis\\tables\\zwxybrl.ctb', 'D:\\nvda fresh\\louis\\tables\\braille-patterns.cti'], inbuf b'N\x00\x00\x00V\x00\x00\x00D\x00\x00\x00A\x00\x00\x00 \x00\x00\x00S\x00\x00\x00e\x00\x00\x00t\x00\x00\x00t\x00\x00\x00i\x00\x00\x00n\x00\x00\x00g\x00\x00\x00s\x00\x00\x00:\x00\x00\x00 \x00\x00\x00B\x00\x00\x00r\x00\x00\x00a\x00\x00\x00i\x00\x00\x00l\x00\x00\x00l\x00\x00\x00e\x00\x00\x00 \x00\x00\x00(\x00\x00\x00n\x00\x00\x00o\x00\x00\x00r\x00\x00\x00m\x00\x00\x00a\x00\x00\x00l\x00\x00\x00 \x00\x00\x00c\x00\x00\x00o\x00\x00\x00n\x00\x00\x00f\x00\x00\x00i\x00\x00\x00g\x00\x00\x00u\x00\x00\x00r\x00\x00\x00a\x00\x00\x00t\x00\x00\x00i\x00\x00\x00o\x00\x00\x00n\x00\x00\x00)\x00\x00\x00 \x00\x00\x00d\x00\x00\x00l\x00\x00\x00g\x00\x00\x00 \x00\x00\x00', typeform None, cursorPos c_long(0), mode 4

May this help. Thanks.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants