Skip to content

Commit 57c64c5

Browse files
authored
Merge 88fb13e into ca52034
2 parents ca52034 + 88fb13e commit 57c64c5

5 files changed

Lines changed: 70 additions & 4 deletions

File tree

source/braille.py

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
# This file is covered by the GNU General Public License.
33
# See the file COPYING for more details.
44
# Copyright (C) 2008-2023 NV Access Limited, Joseph Lee, Babbage B.V., Davy Kager, Bram Duvigneau,
5-
# Leonard de Ruijter
5+
# Leonard de Ruijter, Burman's Computer and Education Ltd.
66

77
import itertools
88
import os
@@ -496,7 +496,11 @@ def update(self):
496496
mode=mode,
497497
cursorPos=self.cursorPos
498498
)
499-
if self.selectionStart is not None and self.selectionEnd is not None:
499+
if (
500+
self.selectionStart is not None
501+
and self.selectionEnd is not None
502+
and config.conf["braille"]["showSelection"]
503+
):
500504
try:
501505
# Mark the selection.
502506
self.brailleSelectionStart = self.rawToBraillePos[self.selectionStart]

source/config/configSpec.py

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,8 @@
11
# -*- coding: UTF-8 -*-
22
# A part of NonVisual Desktop Access (NVDA)
33
# Copyright (C) 2006-2023 NV Access Limited, Babbage B.V., Davy Kager, Bill Dengler, Julien Cochuyt,
4-
# Joseph Lee, Dawid Pieper, mltony, Bram Duvigneau, Cyrille Bougot, Rob Meredith
4+
# Joseph Lee, Dawid Pieper, mltony, Bram Duvigneau, Cyrille Bougot, Rob Meredith,
5+
# Burman's Computer and Education Ltd.
56
# This file is covered by the GNU General Public License.
67
# See the file COPYING for more details.
78

@@ -79,6 +80,7 @@
7980
wordWrap = boolean(default=true)
8081
focusContextPresentation = option("changedContext", "fill", "scroll", default="changedContext")
8182
interruptSpeechWhileScrolling = featureFlag(optionsEnum="BoolFlag", behaviorOfDefault="enabled")
83+
showSelection = featureFlag(optionsEnum="BoolFlag", behaviorOfDefault="enabled")
8284
enableHidBrailleSupport = integer(0, 2, default=0) # 0:Use default/recommended value (yes), 1:yes, 2:no
8385
8486
# Braille display driver settings

source/globalCommands.py

Lines changed: 34 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -44,6 +44,8 @@
4444
TetherTo,
4545
ShowMessages,
4646
)
47+
from config.featureFlag import FeatureFlag
48+
from config.featureFlagEnums import BoolFlag
4749
import winUser
4850
import appModuleHandler
4951
import winKernel
@@ -3288,6 +3290,38 @@ def script_braille_cycleShowMessages(self, gesture: inputCore.InputGesture) -> N
32883290
msg = _("Braille show messages %s") % ShowMessages(newValue).displayString
32893291
ui.message(msg)
32903292

3293+
@script(
3294+
# Translators: Input help mode message for cycle through braille show selection command.
3295+
description=_("Cycle through the braille show selection states"),
3296+
category=SCRCAT_BRAILLE
3297+
)
3298+
def script_braille_cycleShowSelection(self, gesture: inputCore.InputGesture) -> None:
3299+
"""Set next state of braille show selection and reports it with ui.message."""
3300+
featureFlag: FeatureFlag = config.conf["braille"]["showSelection"]
3301+
boolFlag: BoolFlag = featureFlag.enumClassType
3302+
values = [x.value for x in boolFlag]
3303+
currentValue = featureFlag.value.value
3304+
nextValueIndex = (currentValue % len(values)) + 1
3305+
nextName: str = boolFlag(nextValueIndex).name
3306+
config.conf["braille"]["showSelection"] = nextName
3307+
featureFlag = config.conf["braille"]["showSelection"]
3308+
if featureFlag.isDefault():
3309+
displayString = featureFlag.behaviorOfDefault.displayString
3310+
# Translators: Used when reporting braille show selection feature flag
3311+
# default behavior.
3312+
msg = _("Braille show selection default (%s)") % featureFlag.behaviorOfDefault.displayString
3313+
else:
3314+
# Translators: Reports which show braille selection state is used
3315+
# (disabled or enabled).
3316+
msg = _("Braille show selection %s") % BoolFlag[nextName].displayString
3317+
ui.message(msg)
3318+
3319+
def _featureFlagDefaultBehaviorDisplayString(self, displayString: str) -> str:
3320+
"""Returns display string for feature flag default behavior."""
3321+
# Translators: Used when reporting feature flag default behavior.
3322+
msg = _("Default")
3323+
return msg + f" ({displayString})"
3324+
32913325
@script(
32923326
# Translators: Input help mode message for report clipboard text command.
32933327
description=_("Reports the text on the Windows clipboard"),

source/gui/settingsDialogs.py

Lines changed: 13 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@
55
# Derek Riemer, Babbage B.V., Davy Kager, Ethan Holliger, Bill Dengler, Thomas Stivers,
66
# Julien Cochuyt, Peter Vágner, Cyrille Bougot, Mesar Hameed, Łukasz Golonka, Aaron Cannon,
77
# Adriani90, André-Abush Clause, Dawid Pieper, Heiko Folkerts, Takuya Nishimoto, Thomas Stivers,
8-
# jakubl7545, mltony, Rob Meredith
8+
# jakubl7545, mltony, Rob Meredith, Burman's Computer and Education Ltd.
99
# This file is covered by the GNU General Public License.
1010
# See the file COPYING for more details.
1111
import logging
@@ -3665,6 +3665,17 @@ def makeSettings(self, settingsSizer):
36653665
)
36663666
self.bindHelpEvent("BrailleSettingsInterruptSpeech", self.brailleInterruptSpeechCombo)
36673667

3668+
self.brailleShowSelectionCombo: nvdaControls.FeatureFlagCombo = sHelper.addLabeledControl(
3669+
labelText=_(
3670+
# Translators: This is a label for a combo-box in the Braille settings panel.
3671+
"Show se&lection"
3672+
),
3673+
wxCtrlClass=nvdaControls.FeatureFlagCombo,
3674+
keyPath=["braille", "showSelection"],
3675+
conf=config.conf,
3676+
)
3677+
self.bindHelpEvent("BrailleSettingsShowSelection", self.brailleShowSelectionCombo)
3678+
36683679
if gui._isDebug():
36693680
log.debug("Finished making settings, now at %.2f seconds from start"%(time.time() - startTime))
36703681

@@ -3689,6 +3700,7 @@ def onSave(self):
36893700
config.conf["braille"]["wordWrap"] = self.wordWrapCheckBox.Value
36903701
config.conf["braille"]["focusContextPresentation"] = self.focusContextPresentationValues[self.focusContextPresentationList.GetSelection()]
36913702
self.brailleInterruptSpeechCombo.saveCurrentValueToConf()
3703+
self.brailleShowSelectionCombo.saveCurrentValueToConf()
36923704

36933705
def onShowCursorChange(self, evt):
36943706
self.cursorBlinkCheckBox.Enable(evt.IsChecked())

user_docs/en/userGuide.t2t

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1672,6 +1672,20 @@ For this reason the option is enabled by default, interrupting speech when scrol
16721672

16731673
Disabling this option allows speech to be heard while simultaneously reading Braille.
16741674

1675+
==== Show selection ====[BrailleSettingsShowSelection]
1676+
: Default
1677+
Enabled
1678+
: Options
1679+
Default (Enabled), Enabled, Disabled
1680+
:
1681+
1682+
This setting determines if selection indicator (dots 7 and 8) is shown in braille display.
1683+
The option is enabled by default so selection indicator is shown.
1684+
Selection indicator might be a distraction while reading.
1685+
Disabling this option may improve readability.
1686+
1687+
To toggle show selection from anywhere, please assign a custom gesture using the [Input Gestures dialog #InputGestures].
1688+
16751689
+++ Select Braille Display (NVDA+control+a) +++[SelectBrailleDisplay]
16761690
The Select Braille Display dialog, which can be opened by activating the Change... button in the Braille category of the NVDA settings dialog, allows you to select which Braille display NVDA should use for braille output.
16771691
Once you have selected your braille display of choice, you can press Ok and NVDA will load the selected display.

0 commit comments

Comments
 (0)