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

Fix EcoBraille and Lilly braille display drivers #17635

Merged
merged 11 commits into from
Jan 29, 2025

Conversation

LeonarddeR
Copy link
Collaborator

@LeonarddeR LeonarddeR commented Jan 21, 2025

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

See test results for failed build of commit a1fe5402ce

Copy link
Member

@SaschaCowley SaschaCowley left a comment

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.

source/braille.py Outdated Show resolved Hide resolved
@LeonarddeR
Copy link
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 <[email protected]>
@AppVeyorBot
Copy link

See test results for failed build of commit 35b44e5aec

Copy link
Member

@michaelDCurran michaelDCurran left a comment

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
Collaborator Author

I wonder why the tests fail here. Will investigate

@LeonarddeR
Copy link
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

See test results for failed build of commit 705cfc1636

@LeonarddeR
Copy link
Collaborator Author

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

@AppVeyorBot
Copy link

See test results for failed build of commit 64cc17c2b9

source/braille.py Outdated Show resolved Hide resolved
source/braille.py Outdated Show resolved Hide resolved
source/braille.py Outdated Show resolved Hide resolved
Copy link
Member

@SaschaCowley SaschaCowley left a comment

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
5 checks passed
@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.
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