Skip to content

Fix EcoBraille and Lilly braille display drivers#17635

Merged
seanbudd merged 11 commits into
nvaccess:masterfrom
LeonarddeR:LilliFix
Jan 29, 2025
Merged

Fix EcoBraille and Lilly braille display drivers#17635
seanbudd merged 11 commits into
nvaccess:masterfrom
LeonarddeR:LilliFix

Conversation

@LeonarddeR

@LeonarddeR LeonarddeR commented Jan 21, 2025

Copy link
Copy Markdown
Collaborator

Link to issue number:

Fixes #17502

Summary of the issue:

In #15386, support was added for numRows and numCols on braille displays. Setting numCells explicitly would also set numCols.
In #17011, we're much more relying on numCols and numRows.

For the eco braille and Lilli drivers, numCells was implemented by overriding _get_numCells. However this way, the setter of numCells would never be called and therefore numCols would always be 0.

Description of user facing changes

Fix braille for Eco Braille and Lilli displays.

Description of development approach

  1. When calculating display dimensions on the braille handler, when display.numRows is 1, use display.numCells instead of display.numCols. This accounts for cases where numCells is implemented and numRows/numCols are not.
  2. Worked around the ZeroDevisionError when getting windowStartPost on a buffer
  3. Initialize _windowRowBufferOffsets to [(0, 0)] instead of [(0, 1)]. The latter suggests that the window contains one cell, which is not the case. @michaelDCurran you might want to check this.

Testing strategy:

@dreinn Could you test this?

Known issues with pull request:

I think we should consider a long term strategy for numCells vs. numRows/numCols. We still need to account for both now, which isn't ideal and could easily go wrong as proved.

Code Review Checklist:

  • Documentation:
    • Change log entry
    • User Documentation
    • Developer / Technical Documentation
    • Context sensitive help for GUI changes
  • Testing:
    • Unit tests
    • System (end to end) tests
    • Manual testing
  • UX of all users considered:
    • Speech
    • Braille
    • Low Vision
    • Different web browsers
    • Localization in other languages / culture than English
  • API is compatible with existing add-ons.
  • Security precautions taken.

@coderabbitai summary

@LeonarddeR LeonarddeR requested a review from a team as a code owner January 21, 2025 16:02
@AppVeyorBot

Copy link
Copy Markdown

See test results for failed build of commit a1fe5402ce

@SaschaCowley SaschaCowley left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks for this, @LeonarddeR. Just a docstring change while you're here. Plus we need to wait on real world testing.

Comment thread source/braille.py Outdated
@LeonarddeR

Copy link
Copy Markdown
Collaborator Author

I asked an additional review from @michaelDCurran since this touches his code. I'd like to make sure that he agrees with changing the initial state of _windowRowBufferOffsets to reflect that there's no window.

Co-authored-by: Sascha Cowley <16543535+SaschaCowley@users.noreply.github.com>
@AppVeyorBot

Copy link
Copy Markdown

See test results for failed build of commit 35b44e5aec

@michaelDCurran michaelDCurran left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The change looks fine to me. I've also tested with both a single line and multiline display.

@LeonarddeR

Copy link
Copy Markdown
Collaborator Author

I wonder why the tests fail here. Will investigate

@LeonarddeR

Copy link
Copy Markdown
Collaborator Author

I discovered that the system tests were still using the old filter_displaySize extension point, so I fixed that. However I'm not sure whether this is actually related, as manual testing revealed to me taht filter_displaySize still works as expected, even with this pr.

@AppVeyorBot

Copy link
Copy Markdown

See test results for failed build of commit 705cfc1636

@LeonarddeR

Copy link
Copy Markdown
Collaborator Author

It looks like initializing _windowRowBufferOffsets to [(0,0)] breaks the message buffer. I don't yet understand why, though.

@AppVeyorBot

Copy link
Copy Markdown

See test results for failed build of commit 64cc17c2b9

Comment thread source/braille.py Outdated
Comment thread source/braille.py Outdated
Comment thread source/braille.py Outdated

@SaschaCowley SaschaCowley left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks, @LeonarddeR

@SaschaCowley SaschaCowley added conceptApproved Similar 'triaged' for issues, PR accepted in theory, implementation needs review. and removed blocked/needs-testing labels Jan 27, 2025
@seanbudd seanbudd merged commit aa82898 into nvaccess:master Jan 29, 2025
@github-actions github-actions Bot added this to the 2025.1 milestone Jan 29, 2025
LeonarddeR added a commit to LeonarddeR/nvda that referenced this pull request Feb 1, 2025
Fixes nvaccess#17502

Summary of the issue:
In nvaccess#15386, support was added for numRows and numCols on braille displays. Setting numCells explicitly would also set numCols.
In nvaccess#17011, we're much more relying on numCols and numRows.

For the eco braille and Lilli drivers, numCells was implemented by overriding _get_numCells. However this way, the setter of numCells would never be called and therefore numCols would always be 0.

Description of user facing changes
Fix braille for Eco Braille and Lilli displays.

Description of development approach
When calculating display dimensions on the braille handler, when display.numRows is 1, use display.numCells instead of display.numCols. This accounts for cases where numCells is implemented and numRows/numCols are not.
Worked around the ZeroDevisionError when getting windowStartPost on a buffer
Initialize _windowRowBufferOffsets to [(0, 0)] instead of [(0, 1)]. The latter suggests that the window contains one cell, which is not the case. @michaelDCurran you might want to check this.
LeonarddeR added a commit to LeonarddeR/nvda that referenced this pull request Feb 4, 2025
Fixes nvaccess#17502

Summary of the issue:
In nvaccess#15386, support was added for numRows and numCols on braille displays. Setting numCells explicitly would also set numCols.
In nvaccess#17011, we're much more relying on numCols and numRows.

For the eco braille and Lilli drivers, numCells was implemented by overriding _get_numCells. However this way, the setter of numCells would never be called and therefore numCols would always be 0.

Description of user facing changes
Fix braille for Eco Braille and Lilli displays.

Description of development approach
When calculating display dimensions on the braille handler, when display.numRows is 1, use display.numCells instead of display.numCols. This accounts for cases where numCells is implemented and numRows/numCols are not.
Worked around the ZeroDevisionError when getting windowStartPost on a buffer
Initialize _windowRowBufferOffsets to [(0, 0)] instead of [(0, 1)]. The latter suggests that the window contains one cell, which is not the case. @michaelDCurran you might want to check this.
SaschaCowley pushed a commit that referenced this pull request Mar 6, 2025
Follow up of #17011
Slightly related to #17635, as this oversight was found there

Summary of the issue:
In #17011, `braille.filter_displaySize` was deprecated, but there was not yet a mechanism in place that logs warnings about usage of the deprecated extension point.

Description of user facing changes
Warnings in the log when `braille.filter_displaySize.register` is called.

Description of development approach
1. Added an optional keyword argument `_deprecationmessage` to `HandlerRegistrar`. If set, it will be logged when a handler is registered.
2. Removed remaining handlers in core, changed them into handlers for `filter_displayDimensions`
3. Unit test expansion, missing tests for `filter_displayDimensions`

Testing strategy:
Tested that a warning is logged when registering 

Known issues with pull request:
None known
@LeonarddeR LeonarddeR deleted the LilliFix branch August 23, 2025 06:27
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

conceptApproved Similar 'triaged' for issues, PR accepted in theory, implementation needs review.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Braille doesn't work on last snapshot

5 participants