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 #8

Open
wants to merge 2 commits into
base: cloned_master_5ecc2
Choose a base branch
from

Conversation

korbit-ai[bot]
Copy link

@korbit-ai korbit-ai bot commented Aug 29, 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 functionality to speak the character at the cursor position when performing a braille cursor routing action, with a toggle option in the settings.

Why are these changes being made?

This change enhances accessibility by providing auditory feedback for users who rely on braille displays, allowing them to confirm the character they are routing to. The feature is optional and can be enabled in the braille settings, offering flexibility to users who may or may not want this auditory feedback.

Copy link
Author

korbit-ai bot commented Aug 29, 2024

Clone of the PR nvaccess/nvda#16947

Copy link

👋 I'm here to help you review your pull request. When you're ready for me to perform a review, you can comment anywhere on this pull request with this command: /korbit-review.

As a reminder, here are some helpful tips on how we can collaborate together:

  • To have me re-scan your pull request, simply re-invoke the /korbit-review command in a new comment.
  • You can interact with me by tagging @development-korbit-ai-mentor in any conversation in your pull requests.
  • On any comment I make on your code, please leave a 👍 if it is helpful and a 👎 if it is unhelpful. This will help me learn and improve as we work together
  • Lastly, to learn more, check out our Docs.

Copy link
Author

korbit-ai bot commented Aug 29, 2024

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

Copy link

coderabbitai bot commented Aug 29, 2024

Walkthrough

The changes introduce a new feature in NVDA that allows the application to vocalize the character at the cursor position when routing occurs using braille input. This feature is controlled by a new configuration option, speakOnRouting, which can be toggled through the settings interface. The implementation includes updates to multiple files to integrate this functionality, ensuring that user preferences are saved and accessible.

Changes

Files Change Summary
source/braille.py Added _speakOnRouting function for vocalizing characters at the cursor during routing. Modified _routeToTextInfo to call this new function.
source/config/configSpec.py Introduced a new boolean configuration option speakOnRouting with a default value of false.
source/globalCommands.py Added script_braille_toggleSpeakOnRouting function to toggle the speakOnRouting setting.
source/gui/settingsDialogs.py Updated makeSettings to include a checkbox for "Speak character when routing cursor in text" and modified onSave to save this setting.
user_docs/en/changes.md Documented the new feature allowing NVDA to speak characters during braille cursor routing.
user_docs/en/userGuide.md Added a section in the user guide detailing the new braille setting for auditory feedback during routing.

Sequence Diagram(s)

sequenceDiagram
    participant User
    participant BrailleDisplay
    participant Config
    participant Speech

    User->>BrailleDisplay: Route cursor
    BrailleDisplay->>Config: Check speakOnRouting setting
    alt speakOnRouting is enabled
        BrailleDisplay->>Speech: Speak character at cursor
    end
Loading

Recent review details

Configuration used: .coderabbit.yml
Review profile: CHILL

Commits

Files that changed from the base of the PR and between 5ecc243 and 3b0ac70.

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: LGTM! Ensure documentation and tests are updated.

The addition of the new configuration option speakOnRouting under the [braille] section is correct. Ensure that this new option is documented and tested.

source/braille.py (2)

3685-3696: LGTM!

The function is correctly implemented to speak the character at the cursor position after routing.

The code changes are approved.


1643-1643: LGTM! But verify the function usage in the codebase.

The function is correctly calling _speakOnRouting after setting the cursor. Ensure that all function calls to _routeToTextInfo are correctly handled.

The code changes are approved.

Run the following script to verify the function usage:

Verification successful

Function usage is correct and no issues found.

The _routeToTextInfo function is used and defined correctly within the source/braille.py file. The new behavior appears to be integrated properly. No further action is needed.

Scripts executed

The following scripts were executed for the analysis:

Script:

#!/bin/bash
# Description: Verify all function calls to `_routeToTextInfo` match the new behavior.

# Test: Search for the function usage. Expect: Only occurrences of the new behavior.
rg --type python -A 5 $'_routeToTextInfo'

Length of output: 71


Script:

#!/bin/bash
# Corrected script to search for the function usage of `_routeToTextInfo` in the codebase.
rg '_routeToTextInfo' -A 5

Length of output: 1013

source/globalCommands.py (1)

3596-3610: LGTM!

The function correctly toggles the speakOnRouting setting and provides appropriate feedback to the user.

source/gui/settingsDialogs.py (2)

4450-4457: LGTM!

The new checkbox for the feature "Speak character when routing cursor in text" is correctly implemented.


4525-4525: LGTM!

The new configuration save for the feature "Speak character when routing cursor in text" is correctly implemented.


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 using 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.

Other keywords and placeholders

  • Add @coderabbitai ignore anywhere in the PR description to prevent this PR from being reviewed.
  • Add @coderabbitai summary to generate the high-level summary at a specific location in the PR description.
  • Add @coderabbitai anywhere in the PR title to generate the title automatically.

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

@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: 1

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

2253-2258: Ensure adherence to the one-sentence-per-line style.

The new section is clear and well-written. However, ensure that each sentence is on a new line to adhere to the one-sentence-per-line style used in the rest of the document.

##### Speak character when routing cursor in text {#BrailleSettingsSpeakOnRouting}

If this is enabled, NVDA will automatically speak the character at the cursor when routing to it with braille cursor routing keys.

To toggle this option from anywhere, please assign a custom gesture using the [Input Gestures dialog](#InputGestures).

Comment on lines +18 to +19
* When performing a braille cursor routing action, NVDA can now automatically speak the character ath the cursor. (#8072, @LeonarddeR)
* This option is disabled by default. You can enable "Speak character when routing cursor in text" in NVDA's braille settings.
Copy link

Choose a reason for hiding this comment

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

Fix typographical error.

There is a typographical error in the word "ath". It should be "at".

Apply this diff to fix the error:

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

‼️ IMPORTANT
Carefully review the code before committing. Ensure that it accurately replaces the highlighted code, contains no missing lines, and has no issues with indentation. Thoroughly test & benchmark the code to ensure it meets the requirements.

Suggested change
* When performing a braille cursor routing action, NVDA can now automatically speak the character ath the cursor. (#8072, @LeonarddeR)
* This option is disabled by default. You can enable "Speak character when routing cursor in text" in NVDA's braille settings.
* When performing a braille cursor routing action, NVDA can now automatically speak the character at the cursor. (#8072, @LeonarddeR)
* This option is disabled by default. You can enable "Speak character when routing cursor in text" in NVDA's braille settings.

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.

1 participant