Skip to content

On-demand speech mode - Do not speak anymore during sayAll when SayAll is not launched by a SayAll script#16826

Merged
seanbudd merged 8 commits into
nvaccess:masterfrom
CyrilleB79:speakOnDemFixes
Jul 15, 2024
Merged

On-demand speech mode - Do not speak anymore during sayAll when SayAll is not launched by a SayAll script#16826
seanbudd merged 8 commits into
nvaccess:masterfrom
CyrilleB79:speakOnDemFixes

Conversation

@CyrilleB79

@CyrilleB79 CyrilleB79 commented Jul 5, 2024

Copy link
Copy Markdown
Contributor

Link to issue number:

Fixes #16825

Summary of the issue:

While in on-demand speech mode, NVDA speaks during Say All. This is OK when Say All is launched by a specific Say All script, e.g. NVDA+downArrow. But this should not happen when Say All occurs in other situations, i.e. when a new page is loaded in a browser, when an e-mail is opened or when we go forward in a PowerPoint slideshow.

Description of user facing changes

In on-demand mode, NVDA will not talk anymore during Say All if Say All was not launched by an explicit Say All script.

Description of development approach

In speech/sayAll.py, add a new parameter to SayAllHandler.readObjects and to SayAllHandler.readText to determine if the Say All was started from an explicit Say All script or not. This parameter can be None if SayAll is resumed after a script's execution (skim reading case); in this case the previous value of startedFromScript is kept. This value is then used to know if the speech should be output or not.

While at it, I have added to on-demand scripts an Eclipse script to read the documentation; this script seems to have been forgotten during on-demand development.

Testing strategy:

Manual tests in on-demand speech mode and in normal speech mode:

  • Should speak in all cases:
    • Scripts that only speak, e.g. NVDA+t, `NVDA+numpad5
    • Scripts meant to trigger a SayAll: NVDA+downArrow, numpad+, NVDA+B, NVDA+control+alt+downArrow
    • During input help
  • Should not speak in on-demand mode, but only in normal mode:
  • Scripts that perform an action other than reporting something, e.g. NVDA+numpad4/6, NVDA+2
  • When a webpage is loaded
  • When an e-mail message is opened in Outlook
  • During a PowerPoint slideshow

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.

Summary by CodeRabbit

  • Bug Fixes

    • Fixed an issue where NVDA would speak unexpectedly in Outlook, browsing, or PowerPoint when using on-demand speech mode.
  • New Features

    • Improved control over NVDA's speech output with new parameters for script-initiated actions, enhancing customization and behavior in various contexts.

@AppVeyorBot

Copy link
Copy Markdown

See test results for failed build of commit e9f5118b35

@CyrilleB79 CyrilleB79 marked this pull request as ready for review July 8, 2024 06:42
@CyrilleB79 CyrilleB79 requested a review from a team as a code owner July 8, 2024 06:42
@CyrilleB79 CyrilleB79 requested a review from michaelDCurran July 8, 2024 06:42
@coderabbitai

coderabbitai Bot commented Jul 8, 2024

Copy link
Copy Markdown
Contributor

Walkthrough

The updates incorporate the speakOnDemand and startedFromScript parameters to various functions across multiple files. These parameters aim to modify the behavior of speech in the NVDA screen reader, particularly in on-demand speech mode. These changes ensure that speech is executed conditionally based on whether the function was triggered by a script and the mode of operation.

Changes

File Change Summary
source/appModules/eclipse.py Added speakOnDemand=True parameter to script_closeAutocompleter function.
source/documentBase.py Updated readText method in SayAllHandler class with startedFromScript=True parameter.
source/globalCommands.py Added startedFromScript=True parameter to script_review_sayAll, script_sayAll, and script_speakForeground functions.
source/scriptHandler.py Included startedFromScript=None parameter in readText function call inside executeScript function.
source/speech/sayAll.py Added startedFromScript parameter to readObjects and readText functions.
source/speech/speech.py Modified the speak function's conditional logic to include checks involving SayAllHandler.isRunning() and SayAllHandler.startedFromScript.
user_docs/en/changes.md Documented the bug fix related to on-demand speech mode and developer changes.

Assessment against linked issues

Objective Addressed Explanation
NVDA should not speak in on-demand speech mode when navigating PowerPoint slides (#16825)
Inclusion of speakOnDemand and startedFromScript parameters to control speech behavior (#16825)

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.

CodeRabbit Configration File (.coderabbit.yaml)

  • You can programmatically configure CodeRabbit by adding a .coderabbit.yaml file to the root of your repository.
  • Please see the configuration documentation for more information.
  • If your editor has YAML language server enabled, you can add the path at the top of this file to enable auto-completion and validation: # yaml-language-server: $schema=https://coderabbit.ai/integrations/schema.v2.json

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.

@coderabbitai coderabbitai Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Actionable comments posted: 1

Comment thread source/appModules/eclipse.py
Comment thread source/scriptHandler.py
_isScriptRunning = False
if resumeSayAllMode is not None:
sayAll.SayAllHandler.readText(resumeSayAllMode)
sayAll.SayAllHandler.readText(resumeSayAllMode, startedFromScript=None)

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Shouldn't this be

Suggested change
sayAll.SayAllHandler.readText(resumeSayAllMode, startedFromScript=None)
sayAll.SayAllHandler.readText(resumeSayAllMode, startedFromScript=False)

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

or is this meant to be True?

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

It's None meaning that sayAll.SayAllHandler.startedFromScript should not be modified with this action. It should not be modified because this call is to resume an existing say all action, not to start it.

Should I make it somewhat more explicit? With a comment or otherwise?

Comment thread source/speech/sayAll.py Outdated
Comment thread source/speech/sayAll.py Outdated
@seanbudd seanbudd marked this pull request as draft July 12, 2024 00:15
CyrilleB79 and others added 2 commits July 14, 2024 22:38
Co-authored-by: Sean Budd <seanbudd123@gmail.com>
Comment thread source/speech/sayAll.py
shouldUpdateCaret: bool = True,
startedFromScript: bool | None = False,
) -> None:
"""Start or restarts the reader

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

@seanbudd, @LeonarddeR, not sure that my Sphinx formatting of docstring is OK. As requested in the past, an example directly in NVDA's codingStandards.md file would be appreciated; the Sphinx tutorial that is linked instead does not match exactly our recommendations since the examples are with types.

Comment thread source/speech/sayAll.py Outdated
"""Start or restarts the reader
:cursor: the type of cursor used for say all
:startPos: start position (only used for table say all)
:nextLineFunc: function called to read the next line (only used for table say all)

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

@mltony some of the parameters of this functions have been introduced with table say all. Does the description seems OK to you or would you suggest something different or more precise? Thanks.

@seanbudd seanbudd marked this pull request as ready for review July 15, 2024 01:55
Comment thread source/speech/sayAll.py Outdated
Comment thread source/speech/sayAll.py Outdated
Comment thread source/speech/sayAll.py Outdated
@seanbudd seanbudd merged commit 76a4d9b into nvaccess:master Jul 15, 2024
@CyrilleB79 CyrilleB79 deleted the speakOnDemFixes branch July 15, 2024 20:53
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

On-demand speech mode - NVDA still talks in PowerPoint when going to next slide

3 participants