Skip to content

Commit d009a72

Browse files
authored
Merge 1c88c49 into 3f82ab6
2 parents 3f82ab6 + 1c88c49 commit d009a72

5 files changed

Lines changed: 30 additions & 2 deletions

File tree

source/config/configSpec.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -179,6 +179,7 @@
179179
allowSkimReadingInSayAll = boolean(default=False)
180180
alertForSpellingErrors = boolean(default=True)
181181
handleInjectedKeys= boolean(default=true)
182+
multiPressTimeout = integer(default=500, min=100, max=20000)
182183
183184
[virtualBuffers]
184185
maxLineLength = integer(default=100)

source/gui/settingsDialogs.py

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1977,6 +1977,19 @@ def makeSettings(self, settingsSizer):
19771977
self.bindHelpEvent("KeyboardSettingsHandleKeys", self.handleInjectedKeysCheckBox)
19781978
self.handleInjectedKeysCheckBox.SetValue(config.conf["keyboard"]["handleInjectedKeys"])
19791979

1980+
minTimeout = int(config.conf.getConfigValidation(("keyboard", "multiPressTimeout")).kwargs["min"])
1981+
maxTimeout = int(config.conf.getConfigValidation(("keyboard", "multiPressTimeout")).kwargs["max"])
1982+
# Translators: The label for a control in keyboard settings to modify the timeout for a multiple keypress.
1983+
multiPressTimeoutText = _("&Multiple press timeout (ms):")
1984+
self.multiPressTimeoutEdit = sHelper.addLabeledControl(
1985+
multiPressTimeoutText,
1986+
nvdaControls.SelectOnFocusSpinCtrl,
1987+
min=minTimeout,
1988+
max=maxTimeout,
1989+
initial=config.conf["keyboard"]["multiPressTimeout"],
1990+
)
1991+
self.bindHelpEvent("MultiPressTimeout", self.multiPressTimeoutEdit)
1992+
19801993
def isValid(self) -> bool:
19811994
# #2871: check whether at least one key is the nvda key.
19821995
if not self.modifierList.CheckedItems:
@@ -2008,6 +2021,7 @@ def onSave(self):
20082021
config.conf["keyboard"]["speakCommandKeys"] = self.commandKeysCheckBox.IsChecked()
20092022
config.conf["keyboard"]["alertForSpellingErrors"] = self.alertForSpellingErrorsCheckBox.IsChecked()
20102023
config.conf["keyboard"]["handleInjectedKeys"] = self.handleInjectedKeysCheckBox.IsChecked()
2024+
config.conf["keyboard"]["multiPressTimeout"] = self.multiPressTimeoutEdit.GetValue()
20112025

20122026

20132027
class MouseSettingsPanel(SettingsPanel):

source/scriptHandler.py

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -290,7 +290,10 @@ def executeScript(script, gesture):
290290
try:
291291
scriptTime = time.time()
292292
scriptRef = weakref.ref(scriptFunc)
293-
if (scriptTime - _lastScriptTime) <= 0.5 and scriptFunc == lastScriptRef:
293+
if (
294+
(scriptTime - _lastScriptTime) * 1000 <= config.conf["keyboard"]["multiPressTimeout"]
295+
and scriptFunc == lastScriptRef
296+
):
294297
_lastScriptCount += 1
295298
else:
296299
_lastScriptCount = 0
@@ -311,7 +314,7 @@ def getLastScriptRepeatCount():
311314
@returns: a value greater or equal to 0. If the script has not been repeated it is 0, if it has been repeated once its 1, and so forth.
312315
@rtype: integer
313316
"""
314-
if (time.time() - _lastScriptTime) > 0.5:
317+
if (time.time() - _lastScriptTime) * 1000 > config.conf["keyboard"]["multiPressTimeout"]:
315318
return 0
316319
else:
317320
return _lastScriptCount

user_docs/en/changes.md

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,7 @@
99
* Enhanced Microsoft Word comment command: press twice to present comment content in browsable message. (#16800, @Cary-Rowen)
1010
* Enhanced Microsoft Excel notes command: press twice to present notes content in browsable message. (#16878, @Cary-Rowen)
1111
* NVDA can now be configured to report font attributes in speech and braille separately. (#16755)
12+
* The timeout to perform a multiple keypress is now configurable; this may be especially useful for people with dexterity impairment. (#11929, @CyrilleB79)
1213

1314

1415
### Bug Fixes
@@ -4994,3 +4995,4 @@ Major highlights of this release include support for 64 bit editions of Windows;
49944995
* NVDA now asks if it should save configuration and restart if the user has just changed the language in the User Interface Settings Dialog. NVDA must be restarted for the language change to fully take effect.
49954996
* If a synthesizer can not be loaded, when choosing it from the synthesizer dialog, a message box alerts the user to the fact.
49964997
* When loading a synthesizer for the first time, NVDA lets the synthesizer choose the most suitable voice, rate and pitch parameters, rather than forcing it to defaults it thinks are ok. This fixes a problem where Eloquence and Viavoice sapi4 synths start speaking way too fast for the first time.
4998+

user_docs/en/userGuide.md

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2516,6 +2516,14 @@ This option is only available if reporting of spelling errors is enabled in NVDA
25162516
This option allows the user to control if key presses generated by applications such as on-screen keyboards and speech recognition software should be processed by NVDA.
25172517
This option is on by default, though certain users may wish to turn this off, such as those typing Vietnamese with the UniKey typing software as it will cause incorrect character input.
25182518

2519+
##### Multiple press timeout {#MultiPressTimeout}
2520+
2521+
Some NVDA keyboard gestures perform different actions based upon how many times the same key is pressed in rapid succession.
2522+
An example of this is the Report current character of navigator object command, which reports the character if pressed once, a phonetic description of the character if pressed twice, and the numeric value of the character if pressed three times.
2523+
This option configures the timeout after which an additional press of the same key will start a new gesture, rather than being taken as an additional press of the first one.
2524+
The default timeout is 500 ms, i.e. half a second.
2525+
Increasing this timeout may be especially useful for people using sticky keys, or who have a physical disability.
2526+
25192527
#### Mouse {#MouseSettings}
25202528

25212529
<!-- KC:setting -->

0 commit comments

Comments
 (0)