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

Added ability for braille to show what NVDA is speaking #15956

Merged
merged 167 commits into from Apr 16, 2024
Merged
Show file tree
Hide file tree
Changes from 68 commits
Commits
Show all changes
167 commits
Select commit Hold shift + click to select a range
2216282
made some functions compatible with speech emulation mode
Emil-18 Dec 19, 2023
8c5c6e0
made some braille commands that are related to cursor/selection give …
Emil-18 Dec 19, 2023
e95e8ea
added a select mode combo box to the braille settings pannel
Emil-18 Dec 19, 2023
fc27025
modified speech and cancelSpeech, to support speech emulation mode
Emil-18 Dec 19, 2023
b81738a
added a command to cycle through the available braille modes
Emil-18 Dec 20, 2023
105ad6b
added a optional argument to cancelSpeech wich determens if it should…
Emil-18 Dec 20, 2023
3da5cfd
removed commented code that wasnt neaded
Emil-18 Dec 20, 2023
7f9b563
updated the executeGesture function to set clearBrailleRegions to Fal…
Emil-18 Dec 21, 2023
a3343b6
updated changes.t2t
Emil-18 Dec 22, 2023
f9814b0
changed cursor tethering to follow cursors
Emil-18 Dec 22, 2023
cd0f254
made speech.speak much less likely to freeze NVDA when using speech e…
Emil-18 Dec 22, 2023
52b60b3
fixed a bug with the toggleBrailleMode script
Emil-18 Dec 22, 2023
e466266
added a section for the braille mode combo box
Emil-18 Dec 22, 2023
789bc9f
settings that are only applicable for the follow cursors mode is now …
Emil-18 Dec 22, 2023
ccdd5e5
Merge branch 'nvaccess:master' into emulateSpeech
Emil-18 Dec 22, 2023
4551ca8
It is now possible to change from speech emulation to follow cursors …
Emil-18 Dec 23, 2023
c8666c1
Merge branch 'emulateSpeech' of https://github.com/Emil-18/nvda into …
Emil-18 Dec 23, 2023
6d98602
Fixed the placement of the braille mode script
Emil-18 Dec 24, 2023
3815709
Added a blank line between the key command and description of the bra…
Emil-18 Dec 24, 2023
4223589
Fixed linting issues
Emil-18 Dec 24, 2023
3e7053c
Fixed syntax errors
Emil-18 Dec 24, 2023
4327bf5
Fixed linting issues
Emil-18 Dec 25, 2023
59074b2
Added a BrailleMode config option
Emil-18 Dec 25, 2023
70975f8
Delete user_docs/en/keyCommands.t2t
Emil-18 Dec 25, 2023
6c186c6
Update source/config/configFlags.py
Emil-18 Dec 27, 2023
792d6ce
Update source/config/configSpec.py
Emil-18 Dec 27, 2023
0505306
Update source/globalCommands.py
Emil-18 Dec 27, 2023
7223721
Update source/braille.py
Emil-18 Dec 27, 2023
098df14
Update user_docs/en/userGuide.t2t
Emil-18 Dec 27, 2023
fe119c5
Fixed the section about the braille modes
Emil-18 Dec 27, 2023
74eceb6
changed speech emulation to speech output
Emil-18 Dec 27, 2023
4ea48b3
Update source/globalCommands.py
Emil-18 Dec 27, 2023
6485e55
Fixed linting issues
Emil-18 Dec 27, 2023
662d9be
Fixed linting issues and moved the showing of speech in braille out i…
Emil-18 Dec 27, 2023
f252f8b
Merge branch 'nvaccess:master' into emulateSpeech
Emil-18 Dec 27, 2023
554933a
Merge branch 'emulateSpeech' of https://github.com/Emil-18/nvda into …
Emil-18 Dec 27, 2023
3c5be60
Fixed linting issues
Emil-18 Dec 27, 2023
7bffe47
added type information to the _regions variable
Emil-18 Dec 27, 2023
af76176
updated changes.t2t
Emil-18 Dec 27, 2023
efedd59
Fixed linting issues
Emil-18 Dec 27, 2023
ac7847d
Fixed linting issues
Emil-18 Dec 28, 2023
c2f680c
renamed the speech output braille mode to display speech output
Emil-18 Dec 28, 2023
aae2b2b
significantly improved the responsiveness when display speech output …
Emil-18 Dec 28, 2023
21cd197
Updated changes.t2t
Emil-18 Dec 28, 2023
c3cc325
Update source/braille.py
Emil-18 Dec 29, 2023
6223f30
Update source/globalCommands.py
Emil-18 Dec 29, 2023
d558464
Update user_docs/en/userGuide.t2t
Emil-18 Dec 29, 2023
44b9902
Update source/globalCommands.py
Emil-18 Dec 29, 2023
2973237
Update source/globalCommands.py
Emil-18 Dec 29, 2023
64cfe7a
Update user_docs/en/changes.t2t
Emil-18 Dec 29, 2023
1f3ab64
Update source/speech/speech.py
Emil-18 Dec 29, 2023
fd00576
Update source/speech/speech.py
Emil-18 Dec 29, 2023
766b852
Update source/speech/speech.py
Emil-18 Dec 29, 2023
5a7fee2
Update source/gui/settingsDialogs.py
Emil-18 Dec 29, 2023
b4f1600
Update source/gui/settingsDialogs.py
Emil-18 Dec 29, 2023
72bc83b
Update source/gui/settingsDialogs.py
Emil-18 Dec 29, 2023
7f122e3
Update source/gui/settingsDialogs.py
Emil-18 Dec 29, 2023
d268ffc
Added a block action on scripts that only should be activated in foll…
Emil-18 Dec 30, 2023
ecb8f06
Added a BRAILLE_MODE_SPEECH_OUTPUT block action
Emil-18 Dec 31, 2023
d17a1f0
Fixed linting issues
Emil-18 Dec 31, 2023
28a4c4a
added type hinting to the _showSpeechInBraille function
Emil-18 Dec 31, 2023
48c89cd
Updated changes.t2t
Emil-18 Dec 31, 2023
9fbd595
Merge branch 'nvaccess:master' into emulateSpeech
Emil-18 Dec 31, 2023
43a2994
Fixed linting issues
Emil-18 Dec 31, 2023
e004568
Fixed linting issues
Emil-18 Dec 31, 2023
64479db
Updated the description for the toggleBrailleMode script
Emil-18 Dec 31, 2023
5f7474e
Fixed linting issues
Emil-18 Dec 31, 2023
06ea2e9
Apply suggestions from code review
seanbudd Jan 2, 2024
eb9014a
Fixed spelling error
Emil-18 Jan 2, 2024
cb1c051
reverted last commit
Emil-18 Jan 2, 2024
e8ce41c
Merge branch 'emulateSpeech' of https://github.com/Emil-18/nvda into …
Emil-18 Jan 2, 2024
50a6964
Fixed spelling error
Emil-18 Jan 2, 2024
5447dc0
Merge branch 'nvaccess:master' into emulateSpeech
Emil-18 Jan 7, 2024
a19cbab
Updated changes.t2t
Emil-18 Jan 10, 2024
7cb43b5
Merge branch 'nvaccess:master' into emulateSpeech
Emil-18 Jan 10, 2024
dbce52a
Updated changes.t2t
Emil-18 Jan 10, 2024
9a71382
Merge branch 'emulateSpeech' of https://github.com/Emil-18/nvda into …
Emil-18 Jan 10, 2024
f3b1829
Added a pre_speechCanceled and a pre_speech extension point
Emil-18 Jan 11, 2024
706a25e
added new extension points to cancelSpeech and speak
Emil-18 Jan 11, 2024
87ad2e0
added pre_speechCanceled and pre_speech extension points
Emil-18 Jan 11, 2024
c139507
Moved the speech output braille mode implementation to braille.py
Emil-18 Jan 11, 2024
ac9bf8b
Removed braille import
Emil-18 Jan 11, 2024
9e11c48
Added entries for pre_speech and pre_speechCanceled extension points
Emil-18 Jan 11, 2024
e472bf4
Moved the registering of pre_speechCanceled and pre_speech to initialise
Emil-18 Jan 11, 2024
14949dc
updated changes.t2t
Emil-18 Jan 11, 2024
4235400
Fixed linting issues
Emil-18 Jan 11, 2024
d85acc3
Merge branch 'nvaccess:master' into emulateSpeech
Emil-18 Jan 13, 2024
8c01cb7
Fixed linting issues
Emil-18 Jan 13, 2024
6733bca
fixed a bug in the _showSpeechInBraille function
Emil-18 Jan 14, 2024
5e84906
Merge branch 'nvaccess:master' into emulateSpeech
Emil-18 Jan 15, 2024
81fe31a
Merge branch 'nvaccess:master' into emulateSpeech
Emil-18 Jan 15, 2024
5dfdea0
Update projectDocs/dev/developerGuide/developerGuide.t2t
Emil-18 Jan 16, 2024
fdaea00
Update source/braille.py
Emil-18 Jan 16, 2024
aab18c0
Update source/braille.py
Emil-18 Jan 16, 2024
dccfaa6
Update source/braille.py
Emil-18 Jan 16, 2024
1fa0919
Update source/braille.py
Emil-18 Jan 16, 2024
4ad59dd
Update source/speech/extensions.py
Emil-18 Jan 16, 2024
e6567a0
Update source/speech/extensions.py
Emil-18 Jan 16, 2024
11ccec0
Update source/speech/extensions.py
Emil-18 Jan 16, 2024
4d7a23a
Update source/speech/extensions.py
Emil-18 Jan 16, 2024
26003e7
Update user_docs/en/changes.t2t
Emil-18 Jan 16, 2024
5099373
Update user_docs/en/changes.t2t
Emil-18 Jan 16, 2024
a944c91
Update source/globalCommands.py
Emil-18 Jan 16, 2024
1396904
Fixed linting issues
Emil-18 Jan 16, 2024
449867e
Fixed linting issues
Emil-18 Jan 16, 2024
8e0007a
Merge branch 'nvaccess:master' into emulateSpeech
Emil-18 Jan 19, 2024
f65f41f
Added type information to the clearBrailleRegions function
Emil-18 Jan 19, 2024
88c6f4c
updated extensions.py
Emil-18 Jan 20, 2024
74e2941
Update source/config/configFlags.py
Emil-18 Jan 22, 2024
2bc3009
Merge branch 'nvaccess:master' into emulateSpeech
Emil-18 Jan 22, 2024
cd59bbc
Updated braille.py
Emil-18 Jan 22, 2024
6dc3897
Merge branch 'nvaccess:master' into emulateSpeech
Emil-18 Jan 23, 2024
81845d2
Update source/braille.py
Emil-18 Jan 23, 2024
9af214e
Update source/braille.py
Emil-18 Jan 23, 2024
338ba5f
Updated braille.py
Emil-18 Jan 23, 2024
fcda7bb
Updated braille.py
Emil-18 Jan 23, 2024
faec40f
Fixed linting issues
Emil-18 Jan 23, 2024
fa7df0c
Merge branch 'nvaccess:master' into emulateSpeech
Emil-18 Jan 24, 2024
6deaa06
Merge branch 'nvaccess:master' into emulateSpeech
Emil-18 Jan 27, 2024
2b8914f
Updated braille.py
Emil-18 Jan 27, 2024
16e6c01
Updated inputCore.py
Emil-18 Jan 27, 2024
9e3ba2c
Removed the clearBrailleRegions argument
Emil-18 Jan 27, 2024
8f27920
The settings related to the follow cursors braille mode is now proper…
Emil-18 Jan 28, 2024
aef5a8f
Fixed linting issue
Emil-18 Jan 28, 2024
9ee211b
Update source/gui/settingsDialogs.py
Emil-18 Jan 29, 2024
6490d24
fixed linting issues
Emil-18 Jan 30, 2024
1990054
fixed the naming of the speech output braille mode
Emil-18 Jan 30, 2024
e1e0bcb
Updated changes.t2t
Emil-18 Jan 30, 2024
afb7466
Updated changes.t2t
Emil-18 Jan 30, 2024
1c98ed3
Updated changes.t2t
Emil-18 Jan 30, 2024
b25facf
Merge branch 'nvaccess:master' into emulateSpeech
Emil-18 Jan 30, 2024
0867a6a
Updated changes.t2t
Emil-18 Jan 30, 2024
d28b151
Merge branch 'emulateSpeech' of https://github.com/Emil-18/nvda into …
Emil-18 Jan 30, 2024
1aaa22c
Update user_docs/en/userGuide.t2t
seanbudd Feb 2, 2024
7f28bd3
Update source/braille.py
Emil-18 Feb 8, 2024
3bb8735
Update source/braille.py
Emil-18 Feb 8, 2024
1648816
Update source/config/configFlags.py
Emil-18 Feb 8, 2024
3f91bd8
Update source/gui/blockAction.py
Emil-18 Feb 8, 2024
7d0a801
updated changes.t2t
Emil-18 Feb 8, 2024
7ae5573
Merge branch 'nvaccess:master' into emulateSpeech
Emil-18 Feb 8, 2024
881248e
updated changes.t2t
Emil-18 Feb 8, 2024
836272b
changed ScriptT to InputGestureScriptT
Emil-18 Feb 8, 2024
1469fc0
Merge branch 'nvaccess:master' into emulateSpeech
Emil-18 Feb 10, 2024
a4c4403
Update source/inputCore.py
Emil-18 Feb 12, 2024
daff04c
Fixed merge conflicts
Emil-18 Feb 13, 2024
45fb231
Removed the delayedCancelSpeech function used for testing
Emil-18 Feb 13, 2024
5a2a849
Fixed murge conflicts
Emil-18 Feb 22, 2024
c32d241
Fixed a syntax error
Emil-18 Feb 23, 2024
670e376
Update source/inputCore.py
Emil-18 Feb 29, 2024
55a1d74
Fixed a syntax error
Emil-18 Feb 29, 2024
cbe4f80
Updated the type hints for the suppressClearBrailleRegions function
Emil-18 Feb 29, 2024
b7fbfef
Fixed linting issues
Emil-18 Mar 3, 2024
115dd7f
Merge branch 'master' into emulateSpeech
Emil-18 Mar 15, 2024
6516b68
Fixed merge conflicts
Emil-18 Mar 15, 2024
cb84277
Update source/gui/settingsDialogs.py
Emil-18 Mar 15, 2024
fb59a69
Fixed linting issues
Emil-18 Mar 16, 2024
c6fcac3
Updated inputCore.py
Emil-18 Mar 29, 2024
0f934d0
Fixed the type hint on the suppressClearBrailleRegions function
Emil-18 Mar 29, 2024
0eede39
Import typing.Callable
Emil-18 Mar 29, 2024
a828b4b
fixed a syntax error
Emil-18 Mar 29, 2024
ed02cc0
Merge branch 'nvaccess:master' into emulateSpeech
Emil-18 Mar 29, 2024
69b2af1
updated inputCore.py
Emil-18 Mar 29, 2024
27408c2
moved the ScriptT definition below the InputGestureClass
Emil-18 Mar 30, 2024
ba77962
Update projectDocs/dev/developerGuide/developerGuide.t2t
Emil-18 Apr 15, 2024
ef5327b
Update user_docs/en/changes.t2t
Emil-18 Apr 15, 2024
1971ae4
Removed an unnecessary blank line
Emil-18 Apr 15, 2024
87e2f90
added a blank line
Emil-18 Apr 15, 2024
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
8 changes: 5 additions & 3 deletions source/braille.py
Expand Up @@ -41,6 +41,7 @@
from config.configFlags import (
ShowMessages,
TetherTo,
BrailleMode,
ReportTableHeaders,
)
from config.featureFlagEnums import ReviewRoutingMovesSystemCaretFlag
Expand Down Expand Up @@ -2385,6 +2386,7 @@ def message(self, text):
not self.enabled
or config.conf["braille"]["showMessages"] == ShowMessages.DISABLED
or text is None
or config.conf["braille"]["mode"] == BrailleMode.SPEECH_OUTPUT.value
Copy link
Contributor

Choose a reason for hiding this comment

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

Why you're using .value here and in all other places when comparing with enum members? This should not be necessary.

):
return
if self.buffer is self.messageBuffer:
Expand Down Expand Up @@ -2427,7 +2429,7 @@ def _dismissMessage(self, shouldUpdate: bool = True):
self.update()

def handleGainFocus(self, obj: "NVDAObject", shouldAutoTether: bool = True) -> None:
if not self.enabled:
if not self.enabled or config.conf["braille"]["mode"] == BrailleMode.SPEECH_OUTPUT.value:
return
if objectBelowLockScreenAndWindowsIsLocked(obj):
return
Expand Down Expand Up @@ -2472,7 +2474,7 @@ def handleCaretMove(
obj: "NVDAObject",
shouldAutoTether: bool = True
) -> None:
if not self.enabled:
if not self.enabled or config.conf["braille"]["mode"] == BrailleMode.SPEECH_OUTPUT.value:
return
if objectBelowLockScreenAndWindowsIsLocked(obj):
return
Expand Down Expand Up @@ -2582,7 +2584,7 @@ def handleUpdate(self, obj: "NVDAObject") -> None:
self._regionsPendingUpdate.add(region)

def handleReviewMove(self, shouldAutoTether=True):
if not self.enabled:
if not self.enabled or config.conf["braille"]["mode"] == BrailleMode.SPEECH_OUTPUT.value:
return
reviewPos = api.getReviewPosition()
if shouldAutoTether:
Expand Down
19 changes: 19 additions & 0 deletions source/config/configFlags.py
Expand Up @@ -97,6 +97,25 @@ def _displayStringLabels(self):
}


@unique
class BrailleMode(DisplayStringStrEnum):
seanbudd marked this conversation as resolved.
Show resolved Hide resolved
"""Enumeration containing the possible config values for "Braille mode" option in braille settings.
Use BrailleMode.MEMBER.value to compare with the config;
use BrailleMode.MEMBER.displayString in the UI for a translatable description of this member.
"""
FOLLOW_CURSORS = "followCursors"
SPEECH_OUTPUT = "speechOutput"

@property
def _displayStringLabels(self):
Emil-18 marked this conversation as resolved.
Show resolved Hide resolved
return{
Emil-18 marked this conversation as resolved.
Show resolved Hide resolved
# Translators: The label for a braille mode
BrailleMode.FOLLOW_CURSORS: _("follow cursors"),
# Translators: The label for a braille mode
BrailleMode.SPEECH_OUTPUT: _("display speech output")
}
seanbudd marked this conversation as resolved.
Show resolved Hide resolved


@unique
class ReportLineIndentation(DisplayStringIntEnum):
"""Enumeration containing the possible config values to report line indent.
Expand Down
1 change: 1 addition & 0 deletions source/config/configSpec.py
Expand Up @@ -58,6 +58,7 @@
# Braille settings
[braille]
display = string(default=auto)
mode = option("followCursors", "speechOutput", default="followCursors")
translationTable = string(default=en-ueb-g1.ctb)
inputTable = string(default=en-ueb-g1.ctb)
expandAtCursor = boolean(default=true)
Expand Down
34 changes: 34 additions & 0 deletions source/globalCommands.py
Expand Up @@ -43,6 +43,7 @@
from config.configFlags import (
TetherTo,
ShowMessages,
BrailleMode,
)
from config.featureFlag import FeatureFlag
from config.featureFlagEnums import BoolFlag
Expand Down Expand Up @@ -114,6 +115,7 @@
# Translators: The name of a category of NVDA commands.
SCRCAT_DOCUMENTFORMATTING = _("Document formatting")


class GlobalCommands(ScriptableObject):
"""Commands that are available at all times, regardless of the current focus.
"""
Expand Down Expand Up @@ -3287,6 +3289,7 @@ def script_toggleBrailleViewer(self, gesture: inputCore.InputGesture):
category=SCRCAT_BRAILLE,
gesture="kb:NVDA+control+t"
)
@gui.blockAction.when(gui.blockAction.Context.BRAILLE_MODE_SPEECH_OUTPUT)
def script_braille_toggleTether(self, gesture):
values = [x.value for x in TetherTo]
index = values.index(config.conf["braille"]["tetherTo"])
Expand All @@ -3304,12 +3307,38 @@ def script_braille_toggleTether(self, gesture):
# (braille can be tethered automatically or to either focus or review position).
ui.message(_("Braille tethered %s") % TetherTo(newTetherChoice).displayString)

@script(
# Translators: Input help mode message for toggle braille mode command
description=_('Toggles braille mode between follow cursors and display speech output'),
Emil-18 marked this conversation as resolved.
Show resolved Hide resolved
category=SCRCAT_BRAILLE,
gesture="kb:nvda+alt+t"
)
def script_toggleBrailleMode(self, gesture: inputCore.InputGesture):
curMode = BrailleMode(config.conf["braille"]["mode"])
modeList = list(BrailleMode)
index = modeList.index(curMode)
index = index + 1 if not index == len(modeList) - 1 else 0
newMode = modeList[index]
config.conf["braille"]["mode"] = newMode.value
if braille.handler.buffer == braille.handler.messageBuffer:
braille.handler._dismissMessage()
braille.handler.mainBuffer.clear()
# Translators: The message reported when switching braille modes
ui.message(_("Braille mode {brailleMode}").format(brailleMode=newMode.displayString))
if newMode == BrailleMode.SPEECH_OUTPUT:
return
if braille.handler.getTether() == TetherTo.REVIEW.value:
braille.handler.handleReviewMove(shouldAutoTether=braille.handler.shouldAutoTether)
return
braille.handler.handleGainFocus(api.getFocusObject())

@script(
# Translators: Input help mode message for cycle through
# braille move system caret when routing review cursor command.
description=_("Cycle through the braille move system caret when routing review cursor states"),
category=SCRCAT_BRAILLE
)
@gui.blockAction.when(gui.blockAction.Context.BRAILLE_MODE_SPEECH_OUTPUT)
def script_braille_cycleReviewRoutingMovesSystemCaret(self, gesture: inputCore.InputGesture) -> None:
# If braille is not tethered to focus, set next state of
# braille Move system caret when routing review cursor.
Expand Down Expand Up @@ -3345,6 +3374,7 @@ def script_braille_cycleReviewRoutingMovesSystemCaret(self, gesture: inputCore.I
description=_("Toggle the way context information is presented in braille"),
category=SCRCAT_BRAILLE
)
@gui.blockAction.when(gui.blockAction.Context.BRAILLE_MODE_SPEECH_OUTPUT)
def script_braille_toggleFocusContextPresentation(self, gesture):
values = [x[0] for x in braille.focusContextPresentations]
labels = [x[1] for x in braille.focusContextPresentations]
Expand All @@ -3366,6 +3396,7 @@ def script_braille_toggleFocusContextPresentation(self, gesture):
description=_("Toggle the braille cursor on and off"),
category=SCRCAT_BRAILLE
)
@gui.blockAction.when(gui.blockAction.Context.BRAILLE_MODE_SPEECH_OUTPUT)
def script_braille_toggleShowCursor(self, gesture):
if config.conf["braille"]["showCursor"]:
# Translators: The message announced when toggling the braille cursor.
Expand All @@ -3384,6 +3415,7 @@ def script_braille_toggleShowCursor(self, gesture):
description=_("Cycle through the braille cursor shapes"),
category=SCRCAT_BRAILLE
)
@gui.blockAction.when(gui.blockAction.Context.BRAILLE_MODE_SPEECH_OUTPUT)
def script_braille_cycleCursorShape(self, gesture):
if not config.conf["braille"]["showCursor"]:
# Translators: A message reported when changing the braille cursor shape when the braille cursor is turned off.
Expand All @@ -3410,6 +3442,7 @@ def script_braille_cycleCursorShape(self, gesture):
description=_("Cycle through the braille show messages modes"),
category=SCRCAT_BRAILLE
)
@gui.blockAction.when(gui.blockAction.Context.BRAILLE_MODE_SPEECH_OUTPUT)
def script_braille_cycleShowMessages(self, gesture: inputCore.InputGesture) -> None:
"""Set next state of braille show messages and reports it with ui.message."""
values = [x.value for x in ShowMessages]
Expand All @@ -3427,6 +3460,7 @@ def script_braille_cycleShowMessages(self, gesture: inputCore.InputGesture) -> N
description=_("Cycle through the braille show selection states"),
category=SCRCAT_BRAILLE
)
@gui.blockAction.when(gui.blockAction.Context.BRAILLE_MODE_SPEECH_OUTPUT)
def script_braille_cycleShowSelection(self, gesture: inputCore.InputGesture) -> None:
"""Set next state of braille show selection and reports it with ui.message."""
featureFlag: FeatureFlag = config.conf["braille"]["showSelection"]
Expand Down
7 changes: 6 additions & 1 deletion source/gui/blockAction.py
Expand Up @@ -4,6 +4,7 @@
# See the file COPYING for more details.

import config
from config.configFlags import BrailleMode
from dataclasses import dataclass
from enum import Enum
from functools import wraps
Expand Down Expand Up @@ -50,7 +51,11 @@ class Context(_Context, Enum):
# version
_("Action unavailable in a temporary version of NVDA"),
)

BRAILLE_MODE_SPEECH_OUTPUT = (
lambda: config.conf["braille"]["mode"] == BrailleMode.SPEECH_OUTPUT.value,
# Translators: Reported when trying to toggle an unsupported setting in speech emulation mode.
_("Action unavailable while the braille mode is set to speech emulation"),
)

seanbudd marked this conversation as resolved.
Show resolved Hide resolved
def when(*contexts: Context):
"""Returns a function wrapper.
Expand Down