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

Add options to set translation and input braille tables according to NVDA's language #17314

Open
wants to merge 23 commits into
base: master
Choose a base branch
from

Conversation

nvdaes
Copy link
Contributor

@nvdaes nvdaes commented Oct 21, 2024

Link to issue number:

Fixes issue #17306

Summary of the issue:

By default, NVDA sets braille tables according to its language. When NVDA's language is changed, by default braille tables are modified accordingly, which may be confusing for users.

Description of user facing changes

In the Braille settings panel, combo boxes for tables have an option to set them according to NVDA's language, so that now this is optional. The automatically selected tables corresponding to the current language are described in parentheses.

Description of development approach

New options have been added to the Braille settings panel. braille, brailleInput and brailleTables modules have been modified so that the "auto" option in configuration can be optional.

Testing strategy:

Tested manually checking that options are presented in the gui and that braille tables are set accordingly.

Known issues with pull request:

None

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

@seanbudd seanbudd added the conceptApproved Similar 'triaged' for issues, PR accepted in theory, implementation needs review. label Oct 21, 2024
@AppVeyorBot
Copy link

  • PASS: Translation comments check.
  • PASS: License check.
  • FAIL: Unit tests. See test results for more information.
  • PASS: Lint check.
  • PASS: System tests (tags: installer NVDA).
  • Build (for testing PR): https://ci.appveyor.com/api/buildjobs/ni6nakjd3v9bh12e/artifacts/output/l10nUtil.exe nvda_snapshot_pr17314-34386,0d25bc42.exe
  • CI timing (mins):
    INIT 0.0,
    INSTALL_START 1.5,
    INSTALL_END 1.0,
    BUILD_START 0.0,
    BUILD_END 29.7,
    TESTSETUP_START 0.0,
    TESTSETUP_END 0.4,
    TEST_START 0.0,
    TEST_END 19.1,
    FINISH_END 0.2

See test results for failed build of commit 0d25bc42d7

Copy link
Collaborator

@LeonarddeR LeonarddeR left a comment

Choose a reason for hiding this comment

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

I like this a lot!

tableName = config.conf["braille"]["translationTable"]
# #6140: Migrate to new table names as smoothly as possible.
newTableName = brailleTables.RENAMED_TABLES.get(tableName)
if newTableName:
tableName = config.conf["braille"]["translationTable"] = newTableName
if tableName != self._table.fileName:
try:
self._table = brailleTables.getTable(tableName)
if config.conf["braille"]["translationTable"] == "auto":
self._table = brailleTables.getDefaultTableForCurLang(brailleTables.TableType.OUTPUT)
Copy link
Collaborator

Choose a reason for hiding this comment

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

Is this correct? Shouldn't this be?

Suggested change
self._table = brailleTables.getDefaultTableForCurLang(brailleTables.TableType.OUTPUT)
tableName = brailleTables.getDefaultTableForCurLang(brailleTables.TableType.OUTPUT)

That means instead of the else block, you can just load tableName.

source/brailleInput.py Outdated Show resolved Hide resolved
source/gui/settingsDialogs.py Outdated Show resolved Hide resolved
)
self.inTableForCurLang = self.inTables[inTableForCurLangIndex]
# Translators: An option in Braille settings to select a braille table automatically, according to the current language.
inTableChoices = [_("Automatic (%s)" % self.inTableForCurLang.displayName)]
Copy link
Collaborator

Choose a reason for hiding this comment

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

Same as above

source/gui/settingsDialogs.py Outdated Show resolved Hide resolved
@nvdaes nvdaes changed the title Set auto for output table Add options to set translation and input braille tables according to NVDA's language Oct 22, 2024
Co-authored-by: Leonard de Ruijter <[email protected]>
@AppVeyorBot
Copy link

See test results for failed build of commit 4a72f93aeb

@nvdaes
Copy link
Contributor Author

nvdaes commented Oct 22, 2024

@LeonarddeR , thanks for your review!
I don't understand well the suggestion about tableName. And I get this error.

 if table != self._table.fileName:                                                                                   
   ^^^^^                                                                                                            

UnboundLocalError: cannot access local variable 'table' where it is not associated with a value

Perhaps we should revert this suggestion?
Not sure.

@nvdaes
Copy link
Contributor Author

nvdaes commented Oct 23, 2024

I assumed that @LeonarddeR suggestion was complete, but now I've committed a fix and this should be ready.

@nvdaes
Copy link
Contributor Author

nvdaes commented Oct 23, 2024

pre-commit.ci run.

@nvdaes nvdaes marked this pull request as ready for review October 23, 2024 07:04
@nvdaes nvdaes requested review from a team as code owners October 23, 2024 07:04
Copy link
Member

@Qchristensen Qchristensen left a comment

Choose a reason for hiding this comment

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

Looks good and will be a welcome improvement for users.

@nvdaes
Copy link
Contributor Author

nvdaes commented Oct 23, 2024

Thanks Quentin.

Copy link
Collaborator

@LeonarddeR LeonarddeR left a comment

Choose a reason for hiding this comment

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

Just small things, feel free to ignore them if you think your code is more appropriate.

tableName = config.conf["braille"]["translationTable"]
# #6140: Migrate to new table names as smoothly as possible.
newTableName = brailleTables.RENAMED_TABLES.get(tableName)
if newTableName:
tableName = config.conf["braille"]["translationTable"] = newTableName
if config.conf["braille"]["translationTable"] == "auto":
Copy link
Collaborator

Choose a reason for hiding this comment

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

tableName already contains the name of config at this point, so it is not necessary to recheck the config here.

Suggested change
if config.conf["braille"]["translationTable"] == "auto":
if tableName == "auto":

# #6140: Migrate to new table names as smoothly as possible.
tableName = config.conf["braille"]["inputTable"]
newTableName = brailleTables.RENAMED_TABLES.get(tableName)
if newTableName:
tableName = config.conf["braille"]["inputTable"] = newTableName
table = config.conf["braille"]["inputTable"]
if table != self._table.fileName:
if config.conf["braille"]["inputTable"] == "auto":
Copy link
Collaborator

Choose a reason for hiding this comment

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

Idem as above

Suggested change
if config.conf["braille"]["inputTable"] == "auto":
if tableName == "auto":

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.

5 participants