-
-
Notifications
You must be signed in to change notification settings - Fork 638
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 pre_filter_speechSequence and post_filter_speechSequence extension point Actions #17429
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change | ||||
---|---|---|---|---|---|---|
|
@@ -1382,7 +1382,9 @@ For examples of how to define and use new extension points, please see the code | |||||
|`Action` |`speechCanceled` |Triggered when speech is canceled.| | ||||||
|`Action` |`pre_speechCanceled` |Triggered before speech is canceled.| | ||||||
|`Action` |`pre_speech` |Triggered before NVDA handles prepared speech.| | ||||||
|`Filter` |`filter_speechSequence` |Allows components or add-ons to filter speech sequence before it passes to the synth driver.| | ||||||
| ``Action`` | ``pre_filter_speechSequence`` | Notifies before speech sequence filters are processed. | | ||||||
| ``Action`` | ``post_filter_speechSequence`` | Notifies after a speech sequence has optionally been filtered by NVDA components and/or add-ons. | | ||||||
| ``Filter`` | ``filter_speechSequence`` | Allows components or add-ons to filter a speech sequence before it is passed to the Synth driver. | | ||||||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
Suggested change
|
||||||
|
||||||
### synthDriverHandler {#synthDriverHandlerExtPts} | ||||||
|
||||||
|
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -27,8 +27,14 @@ | |
from textUtils import unicodeNormalize | ||
from textUtils.uniscribe import splitAtCharacterBoundaries | ||
from . import manager | ||
from .extensions import speechCanceled, pre_speechCanceled, pre_speech | ||
from .extensions import filter_speechSequence | ||
from .extensions import ( | ||
filter_speechSequence, | ||
post_filter_speechSequence, | ||
pre_filter_speechSequence, | ||
pre_speechCanceled, | ||
pre_speech, | ||
speechCanceled, | ||
) | ||
from .commands import ( | ||
# Commands that are used in this file. | ||
BreakCommand, | ||
|
@@ -1073,17 +1079,15 @@ def speak( # noqa: C901 | |
@param symbolLevel: The symbol verbosity level; C{None} (default) to use the user's configuration. | ||
@param priority: The speech priority. | ||
""" | ||
pre_filter_speechSequence.notify(sequence=speechSequence) | ||
speechSequence = filter_speechSequence.apply(speechSequence) | ||
logBadSequenceTypes(speechSequence) | ||
# in case priority was explicitly passed in as None, set to default. | ||
priority: Spri = Spri.NORMAL if priority is None else priority | ||
|
||
if not speechSequence: # Pointless - nothing to speak | ||
return | ||
import speechViewer | ||
|
||
if speechViewer.isActive: | ||
speechViewer.appendSpeechSequence(speechSequence) | ||
post_filter_speechSequence.notify(sequence=speechSequence) | ||
pre_speech.notify(speechSequence=speechSequence, symbolLevel=symbolLevel, priority=priority) | ||
Comment on lines
+1090
to
1091
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. since these are called at the same point in time, aren't they semantically the same? |
||
if _speechState.speechMode == SpeechMode.off: | ||
return | ||
|
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -99,6 +99,10 @@ Add-ons will need to be re-tested and have their manifest updated. | |
* Removed the requirement to indent function parameter lists by two tabs from NVDA's Coding Standards, to be compatible with modern automatic linting. (#17126, @XLTechie) | ||
* Added the [VS Code workspace configuration for NVDA](https://nvaccess.org/nvaccess/vscode-nvda) as a git submodule. (#17003) | ||
* In the `brailleTables` module, a `getDefaultTableForCurrentLang` function has been added (#17222, @nvdaes) | ||
* Added the following extension points: | ||
* ``speech.filter_speechSequence``. (#16191, @beqabeqa473) | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. this has already been added no? this PR doesn't add it. |
||
* ``speech.pre_filter_speechSequence``. (#16213, @beqabeqa473) | ||
* ``speech.post_filter_speechSequence``. (#16213, @beqabeqa473) | ||
|
||
#### API Breaking Changes | ||
|
||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
these should be single backticks, not doubled, please fix the formatting