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 ability to speak character when cursor routing #4

Closed
wants to merge 2 commits into from

Conversation

korbit-ai[bot]
Copy link

@korbit-ai korbit-ai bot commented Aug 21, 2024

Link to issue number:

Closes #8072

Summary of the issue:

When cursor routing, it can sometimes be handy if speech follows along and tells you what character you moved to, especially when the character in braille is unknown to you.

Description of user facing changes

  • Added a new braille option "Speak character when routing cursor in text", disabled by default. When enabled, NVDA will speak the character you routed to after a cursor routing action.

Description of development approach

Added a new option to the config spec, as well as a function to braille to speak the character at the given position. Also added an item to the settings panel as well as an unbound global command.

Testing strategy:

  • Tested that NVDA will speak the character ath the cursor when routing when the option is on
  • Tested that NVDA won't speak the character ath the cursor when routing when the option is off
  • Tested that the global command (when bound) appropriately toggles the option

Known issues with pull request:

None known

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.

Summary by CodeRabbit

  • New Features

    • Introduced a setting to automatically speak the character at the cursor during braille cursor routing, enhancing auditory feedback for improved accessibility.
    • Added a checkbox in settings for users to enable or disable the new speech feature.
    • Implemented a toggle command for the speech feature in braille mode.
  • Documentation

    • Updated user guide to include instructions for the new braille speech feature and customization options.
    • Added notes in the change log regarding default settings and operational benefits for users.

Description by Korbit AI

What change is being made?

Add the ability to speak the character at the cursor position when performing a braille cursor routing action.

Why are these changes being made?

This feature enhances accessibility by providing auditory feedback for braille users, helping them confirm the cursor's position. The option is disabled by default and can be enabled in the braille settings.

Copy link
Author

korbit-ai bot commented Aug 21, 2024

Clone of the PR nvaccess/nvda#16947

Copy link

My review is in progress 📖 - I will have feedback for you in a few minutes!

1 similar comment
Copy link
Author

korbit-ai bot commented Aug 21, 2024

My review is in progress 📖 - I will have feedback for you in a few minutes!

Copy link

coderabbitai bot commented Aug 21, 2024

Walkthrough

This set of changes introduces a new feature in NVDA that enables spoken feedback for braille cursor routing. A new function, _speakOnRouting, is added to vocalize characters at the cursor position based on a configurable option. The configuration setting speakOnRouting is introduced to allow users to enable or disable this feature. Additionally, a checkbox is added to the braille settings interface, and related functionality is incorporated into global commands and saved configurations.

Changes

File Change Summary
source/braille.py Added _speakOnRouting(info: textInfos.TextInfo) function and modified _routeToTextInfo to call it.
source/config/configSpec.py Introduced speakOnRouting = boolean(default=false) configuration option.
source/globalCommands.py Added script_braille_toggleSpeakOnRouting function to toggle speakOnRouting setting.
source/gui/settingsDialogs.py Enhanced makeSettings and onSave methods to include a checkbox for "Speak character when routing cursor in text."
user_docs/en/changes.md Updated documentation to include the new braille cursor routing feature for speaking characters.
user_docs/en/userGuide.md Added user guide section for "Speak character when routing cursor in text" option.

Recent review details

Configuration used: .coderabbit.yml
Review profile: CHILL

Commits

Files that changed from the base of the PR and between 5ecc243 and 1051fba.

Files selected for processing (6)
  • source/braille.py (2 hunks)
  • source/config/configSpec.py (1 hunks)
  • source/globalCommands.py (1 hunks)
  • source/gui/settingsDialogs.py (2 hunks)
  • user_docs/en/changes.md (1 hunks)
  • user_docs/en/userGuide.md (1 hunks)
Additional context used
Path-based instructions (6)
source/config/configSpec.py (2)

Pattern **/*: Focus on code smells, logic errors, edge cases, missing test cases, security flaws and serious issues. Avoid commenting on minor issues such as linting, formatting and style issues. This project uses tabs instead of spaces, do not suggest usage of spaces over tabs. Are there any 'red flags' in this code that might warrant closer investigation from a security standpoint? Explain what makes them suspicious. When providing code suggestions, particularly when requested, ensure GitHub's suggestion format is used, i.e.: suggestion <code changes>


Pattern **/*.py: _, pgettext, ngettext, and ngettext are defined globally, errors for this being undefined can be ignored.

source/braille.py (2)

Pattern **/*: Focus on code smells, logic errors, edge cases, missing test cases, security flaws and serious issues. Avoid commenting on minor issues such as linting, formatting and style issues. This project uses tabs instead of spaces, do not suggest usage of spaces over tabs. Are there any 'red flags' in this code that might warrant closer investigation from a security standpoint? Explain what makes them suspicious. When providing code suggestions, particularly when requested, ensure GitHub's suggestion format is used, i.e.: suggestion <code changes>


Pattern **/*.py: _, pgettext, ngettext, and ngettext are defined globally, errors for this being undefined can be ignored.

source/globalCommands.py (2)

Pattern **/*: Focus on code smells, logic errors, edge cases, missing test cases, security flaws and serious issues. Avoid commenting on minor issues such as linting, formatting and style issues. This project uses tabs instead of spaces, do not suggest usage of spaces over tabs. Are there any 'red flags' in this code that might warrant closer investigation from a security standpoint? Explain what makes them suspicious. When providing code suggestions, particularly when requested, ensure GitHub's suggestion format is used, i.e.: suggestion <code changes>


Pattern **/*.py: _, pgettext, ngettext, and ngettext are defined globally, errors for this being undefined can be ignored.

source/gui/settingsDialogs.py (2)

Pattern **/*: Focus on code smells, logic errors, edge cases, missing test cases, security flaws and serious issues. Avoid commenting on minor issues such as linting, formatting and style issues. This project uses tabs instead of spaces, do not suggest usage of spaces over tabs. Are there any 'red flags' in this code that might warrant closer investigation from a security standpoint? Explain what makes them suspicious. When providing code suggestions, particularly when requested, ensure GitHub's suggestion format is used, i.e.: suggestion <code changes>


Pattern **/*.py: _, pgettext, ngettext, and ngettext are defined globally, errors for this being undefined can be ignored.

user_docs/en/userGuide.md (2)

Pattern **/*: Focus on code smells, logic errors, edge cases, missing test cases, security flaws and serious issues. Avoid commenting on minor issues such as linting, formatting and style issues. This project uses tabs instead of spaces, do not suggest usage of spaces over tabs. Are there any 'red flags' in this code that might warrant closer investigation from a security standpoint? Explain what makes them suspicious. When providing code suggestions, particularly when requested, ensure GitHub's suggestion format is used, i.e.: suggestion <code changes>


Pattern **/*.md: Focus on grammar, spelling, and punctuation. Also consider readability and clarity of contents. Ensure that changes follow the style of one sentence per line, suggest changes if this is not met.

user_docs/en/changes.md (3)

Pattern **/*: Focus on code smells, logic errors, edge cases, missing test cases, security flaws and serious issues. Avoid commenting on minor issues such as linting, formatting and style issues. This project uses tabs instead of spaces, do not suggest usage of spaces over tabs. Are there any 'red flags' in this code that might warrant closer investigation from a security standpoint? Explain what makes them suspicious. When providing code suggestions, particularly when requested, ensure GitHub's suggestion format is used, i.e.: suggestion <code changes>


Pattern **/*.md: Focus on grammar, spelling, and punctuation. Also consider readability and clarity of contents. Ensure that changes follow the style of one sentence per line, suggest changes if this is not met.


Pattern user_docs/en/changes.md: Ensure each change log entry references an issue or pull request number. Change log entries can also include a reference to a GitHub author. Examples of valid change log entries: * Item with sub-items (#123, @username): * sub-item * bar (#342) * Item with. Multiple lines. (#143)

Additional comments not posted (6)
source/config/configSpec.py (1)

93-93: Ensure integration and documentation for speakOnRouting.

The addition of the speakOnRouting option is a good start for implementing the new feature. Ensure that the corresponding logic in the braille cursor routing code checks this option and speaks the character when it's enabled. Additionally, consider adding documentation for this new option in the user guide.

source/braille.py (2)

1643-1643: Integration of _speakOnRouting is well-placed.

The addition of _speakOnRouting(info.copy()) ensures that auditory feedback is provided without altering the original info object, aligning with the PR objectives.


3685-3696: New function _speakOnRouting is well-implemented.

The function correctly checks the configuration setting and uses a late import to avoid circular dependencies. It expands the info to a character unit and uses spellTextInfo to vocalize it, aligning with the feature's purpose.

source/globalCommands.py (1)

3596-3610: Ensure consistent state handling for toggle actions.

The function script_braille_toggleSpeakOnRouting correctly toggles the speakOnRouting setting and provides user feedback. However, ensure that the state of the setting is consistently handled across different parts of the application to avoid discrepancies. Consider adding unit tests to verify the toggle behavior.

source/gui/settingsDialogs.py (2)

4450-4456: Checkbox for "Speak character when routing cursor in text" added correctly.

The checkbox is added with appropriate help event binding and initial value setting.


4525-4525: Configuration for "Speak character when routing cursor in text" saved correctly.

The configuration is saved based on the checkbox state, maintaining consistency with other settings.


Thank you for using CodeRabbit. We offer it for free to the OSS community and would appreciate your support in helping us grow. If you find it useful, would you consider giving us a shout-out on your favorite social media?

Share
Tips

Chat

There are 3 ways to chat with CodeRabbit:

  • Review comments: Directly reply to a review comment made by CodeRabbit. Example:
    • I pushed a fix in commit <commit_id>.
    • Generate unit testing code for this file.
    • Open a follow-up GitHub issue for this discussion.
  • Files and specific lines of code (under the "Files changed" tab): Tag @coderabbitai in a new review comment at the desired location with your query. Examples:
    • @coderabbitai generate unit testing code for this file.
    • @coderabbitai modularize this function.
  • PR comments: Tag @coderabbitai in a new PR comment to ask questions about the PR branch. For the best results, please provide a very specific query, as very limited context is provided in this mode. Examples:
    • @coderabbitai generate interesting stats about this repository and render them as a table.
    • @coderabbitai show all the console.log statements in this repository.
    • @coderabbitai read src/utils.ts and generate unit testing code.
    • @coderabbitai read the files in the src/scheduler package and generate a class diagram using mermaid and a README in the markdown format.
    • @coderabbitai help me debug CodeRabbit configuration file.

Note: Be mindful of the bot's finite context window. It's strongly recommended to break down tasks such as reading entire modules into smaller chunks. For a focused discussion, use review comments to chat about specific files and their changes, instead of using the PR comments.

CodeRabbit Commands (invoked as PR comments)

  • @coderabbitai pause to pause the reviews on a PR.
  • @coderabbitai resume to resume the paused reviews.
  • @coderabbitai review to trigger an incremental review. This is useful when automatic reviews are disabled for the repository.
  • @coderabbitai full review to do a full review from scratch and review all the files again.
  • @coderabbitai summary to regenerate the summary of the PR.
  • @coderabbitai resolve resolve all the CodeRabbit review comments.
  • @coderabbitai configuration to show the current CodeRabbit configuration for the repository.
  • @coderabbitai help to get help.

Additionally, you can add @coderabbitai ignore anywhere in the PR description to prevent this PR from being reviewed.

Documentation and Community

  • Visit our Documentation for detailed information on how to use CodeRabbit.
  • Join our Discord Community to get help, request features, and share feedback.
  • Follow us on X/Twitter for updates and announcements.

Copy link
Author

@korbit-ai korbit-ai bot left a comment

Choose a reason for hiding this comment

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

I have reviewed your code and did not find any issues!


Please note that I can make mistakes, and you should still encourage your team to review your code as well.

Copy link

@development-korbit-ai-mentor development-korbit-ai-mentor bot left a comment

Choose a reason for hiding this comment

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

I have reviewed your code and found 1 potential issue.

Summary of Code Review

Fix for Code Execution:

  • Implement logic in braille cursor routing to check 'speakOnRouting' and speak the character when enabled.

Fix for Code Health:

  • Add documentation for the 'speakOnRouting' option in the user guide.

@@ -90,6 +90,7 @@
unicodeNormalization = featureFlag(optionsEnum="BoolFlag", behaviorOfDefault="disabled")
focusContextPresentation = option("changedContext", "fill", "scroll", default="changedContext")
interruptSpeechWhileScrolling = featureFlag(optionsEnum="BoolFlag", behaviorOfDefault="enabled")
speakOnRouting = boolean(default=false)

Choose a reason for hiding this comment

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

category Functionality

The addition of the 'speakOnRouting' option is a good start for implementing the new feature. However, to ensure full functionality, make sure to implement the corresponding logic in the braille cursor routing code to check this option and speak the character when it's enabled. Also, consider adding documentation for this new option in the user guide.

Chat with Korbit by mentioning @development-korbit-ai-mentor, and give a 👍 or 👎 to help Korbit improve your reviews.

Copy link

Copy link

System configuration at time of review:

- category__name: {'enabled': True, 'user_values': {'minimum_severity': 'nit'}}
- category__database_operations: {'enabled': True, 'user_values': {'minimum_severity': 'nit'}}
- category__documentation: {'enabled': True, 'user_values': {'minimum_severity': 'nit'}}
- category__logging: {'enabled': True, 'user_values': {'minimum_severity': 'nit'}}
- category__error_handling: {'enabled': True, 'user_values': {'minimum_severity': 'nit'}}
- category__systems_and_environment: {'enabled': True, 'user_values': {'minimum_severity': 'nit'}}
- category__objects_and_data_structures: {'enabled': True, 'user_values': {'minimum_severity': 'nit'}}
- category__tests: {'enabled': False, 'user_values': {'minimum_severity': 'nit'}}
- category__readability_and_maintainability: {'enabled': True, 'user_values': {'minimum_severity': 'nit'}}
- category__asynchronous_processing: {'enabled': True, 'user_values': {'minimum_severity': 'nit'}}
- category__design_patterns: {'enabled': True, 'user_values': {'minimum_severity': 'nit'}}
- category__third_party_libraries: {'enabled': True, 'user_values': {'minimum_severity': 'nit'}}
- category__performance: {'enabled': True, 'user_values': {'minimum_severity': 'nit'}}
- category__security: {'enabled': True, 'user_values': {'minimum_severity': 'nit'}}
- pull_request_review_schedule: {'enabled': True, 'user_values': {'review_schedule': 'non-draft'}}
- maximum_shown_issues: {'enabled': True, 'user_values': {'max_issues': 10}}
- auto_pr_description: {'enabled': True, 'user_values': {}}
- category__functionality: {'enabled': True, 'user_values': {'minimum_severity': 'nit'}}

Copy link

@coderabbitai full review

@furwellness
Copy link
Owner

/review

Copy link

PR Reviewer Guide 🔍

⏱️ Estimated effort to review: 2 🔵🔵⚪⚪⚪
🧪 PR contains tests
🔒 No security concerns identified
⚡ Key issues to review

Performance Concern
The _speakOnRouting function is called on every cursor routing action, even when the feature is disabled. Consider moving the config check to the caller.

Typo
There's a typo in the label for the new checkbox. "Spea&k" should be "Speak".

Typo
There's a typo in the changelog entry. "ath" should be "at".

Copy link

@coderabbitai coderabbitai bot left a comment

Choose a reason for hiding this comment

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

Actionable comments posted: 0

Outside diff range, codebase verification and nitpick comments (2)
user_docs/en/userGuide.md (1)

2253-2258: Ensure clarity and consistency in documentation.

The section on "Speak character when routing cursor in text" is clear and concise. Ensure that it follows the style of one sentence per line for consistency with the rest of the document.

Consider breaking long sentences into shorter ones to improve readability.

user_docs/en/changes.md (1)

18-19: Correct the spelling error and ensure clarity.

The word "ath" should be corrected to "at" for clarity.

* When performing a braille cursor routing action, NVDA can now automatically speak the character at the cursor. (#8072, @LeonarddeR)

Copy link

/review

@korbit-ai korbit-ai bot deleted the branch cloned_master_5ecc2 August 29, 2024 19:19
@korbit-ai korbit-ai bot closed this Aug 29, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants