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

Expose number of rows/lines on multiline braille displays #15386

Merged
merged 9 commits into from
Oct 26, 2023

Conversation

bramd
Copy link
Contributor

@bramd bramd commented Sep 6, 2023

Link to issue number:

None

Summary of the issue:

Currently, NVDA assumes that braille displays always have one line of output. There are no native braille drivers in NVDA that support multi line displays.
However, BRLTTY supports a few multi line displays such as the Canute and the DotPad. A first step to supporting these displays would be to treat them as one large display so we can at least output to all their cells. Multi line displays now crash the BRLTTY driver.

Description of user facing changes

Multi line braille displays can now be used through BRLTTY and will no longer cause the driver to crash. Please note that the display is handled as one large continuous display and no specific features exist to use the multiple braille lines for multi line output.

Description of development approach

The BRLTTY driver only reads the number of columns and uses that as numCells. This causes a crashing braille driver with multi line displays, since we send not enough cells to fill the display.

This PR adds numCols and numRows properties to the BrailleDisplayDriver class and the default for numCells is to return the total number of cells on the display. Setting numCells is still supported for single line displays, but for multi line displays this will raise a ValueError and numCols/numRows should be set explicitly.

The BRLTTY driver is modified to set numRows/numCols correctly based on the info from BrlAPI.

Testing strategy:

  • Ran unit tests
  • Tested output with a DotPad connected through BRLTTY

Known issues with pull request:

None

Change log entries:

New features
Changes
Bug fixes

  • Multi line braille displays will no longer crash the BRLTTY driver and are treated as one continuous display
    For Developers
  • The BrailleDisplayDriver base class now has numRows and numCols properties to provide information about multi line braille displays, setting numCells is still supported for single line braille displays and numCells will return the total number of cells for multi line braille displays

Code Review Checklist:

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

@LeonarddeR
Copy link
Collaborator

One thing that can probably be ignored. the ecoBraille and lilli implement _get_numCells explicitly, so in that case numCells and numColls wil differ. That shouldn't be a problem though.

@bramd bramd changed the title Expose nomber of rows/lines on multiline braille displays Expose number of rows/lines on multiline braille displays Sep 6, 2023
@bramd
Copy link
Contributor Author

bramd commented Sep 6, 2023

@LeonarddeR For Lilli we could probably solve this by just making numCells a simple assignment and get rid of the getter, which returns a static value anyway and should trigger set_numCells. For EcoBraille I don't see an easy way to solve this. It might not matter now, but I don't really like it either since numCols is part of the public interface of the BrailleDisplay class and should be reliable.

@bramd bramd marked this pull request as ready for review September 8, 2023 11:31
@bramd bramd requested a review from a team as a code owner September 8, 2023 11:31
@bramd bramd requested a review from seanbudd September 8, 2023 11:31
@bramd
Copy link
Contributor Author

bramd commented Sep 8, 2023

Still not really happy with the Lilli/Ecobraille situation, but see no clear way to fix this. So I would like an initial review and am still open for changes.

@LeonarddeR
Copy link
Collaborator

May be we should leave numCols and numRows alone for single line braille display drivers. This can be done by removing the setter from numCells from the base class. Of course this means you need to undo the changes to the unit test as well.
If NVDA core would ever be adapted to support multi line displays better, it can safely use numCells and if something special regarding multi line displays needs to happen, numRows must be greater than one anyway.

@seanbudd seanbudd added this to the 2024.1 milestone Sep 14, 2023
Copy link
Member

@seanbudd seanbudd left a comment

Choose a reason for hiding this comment

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

Could you confirm these changes?

source/braille.py Outdated Show resolved Hide resolved
source/braille.py Show resolved Hide resolved
source/brailleDisplayDrivers/brltty.py Outdated Show resolved Hide resolved
@seanbudd seanbudd marked this pull request as draft September 27, 2023 23:59
@seanbudd seanbudd added the conceptApproved Similar 'triaged' for issues, PR accepted in theory, implementation needs review. label Oct 16, 2023
@bramd
Copy link
Contributor Author

bramd commented Oct 22, 2023

@seanbudd Thanks for your review suggestions, I have applied them. If we accept the slightly API breaking change I think this is ready for merging.

@bramd bramd marked this pull request as ready for review October 22, 2023 13:06
@seanbudd
Copy link
Member

@bramd - I don't think this counts as an API breaking change - could you explain how the API would break for an add-on?

@bramd
Copy link
Contributor Author

bramd commented Oct 25, 2023

@bramd - I don't think this counts as an API breaking change - could you explain how the API would break for an add-on?

Drivers providing their own get_numCells implementation may and up with a difference in numCols and numCells, but since nothing consumes numCols yet, this is not an issue for now. As long as we stick with numCells in NVDA core for single line displays, I don't see any issues.

@seanbudd seanbudd merged commit 3304bd4 into nvaccess:master Oct 26, 2023
1 check passed
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.

3 participants