Skip to content
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions source/config/configSpec.py
Original file line number Diff line number Diff line change
Expand Up @@ -204,6 +204,7 @@
audioDucking = boolean(default=false)
gui = boolean(default=false)
louis = boolean(default=false)
timeSinceInput = boolean(default=false)

[uwpOcr]
language = string(default="")
Expand Down
16 changes: 15 additions & 1 deletion source/inputCore.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
#A part of NonVisual Desktop Access (NVDA)
#This file is covered by the GNU General Public License.
#See the file COPYING for more details.
#Copyright (C) 2010-2017 NV Access Limited, Babbage B.V.
#Copyright (C) 2010-2019 NV Access Limited, Babbage B.V., Mozilla Corporation

"""Core framework for handling input from the user.
Every piece of input from the user (e.g. a key press) is represented by an L{InputGesture}.
Expand All @@ -14,6 +14,7 @@
import os
import itertools
import weakref
import time
import configobj
import sayAllHandler
import baseObject
Expand Down Expand Up @@ -403,6 +404,7 @@ def __init__(self):
self.userGestureMap = GlobalGestureMap()
self.loadLocaleGestureMap()
self.loadUserGestureMap()
self._lastInputTime = None

def executeGesture(self, gesture):
"""Perform the action associated with a gesture.
Expand Down Expand Up @@ -440,6 +442,7 @@ def executeGesture(self, gesture):
queueHandler.queueFunction(queueHandler.eventQueue, speech.pauseSpeech, speechEffect == gesture.SPEECHEFFECT_PAUSE)

if log.isEnabledFor(log.IO) and not gesture.isModifier:
self._lastInputTime = time.time()
log.io("Input: %s" % gesture.identifiers[0])

if self._captureFunc:
Expand Down Expand Up @@ -787,3 +790,14 @@ def terminate():
"""
global manager
manager=None

def logTimeSinceInput():
"""Log the time since the last input was received.
This does nothing if time since input logging is disabled.
"""
if (not log.isEnabledFor(log.IO)
or not config.conf["debugLog"]["timeSinceInput"]
or not manager or not manager._lastInputTime
):
return
log.io("Time since input: %.3f sec" % (time.time() - manager._lastInputTime))
Comment thread
jcsteh marked this conversation as resolved.
Resolved
4 changes: 4 additions & 0 deletions source/speech.py
Original file line number Diff line number Diff line change
Expand Up @@ -240,6 +240,8 @@ def _speakSpellingGen(text,locale,useCharacterDescriptions):
synth.pitch=max(0,min(oldPitch+synthConfig["capPitchChange"],100))
count = len(char)
index=count+1
import inputCore
inputCore.logTimeSinceInput()
log.io("Speaking character %r"%char)
speechSequence=[LangChangeCommand(locale)] if config.conf['speech']['autoLanguageSwitching'] else []
if len(char) == 1 and synthConfig["useSpellingFunctionality"]:
Expand Down Expand Up @@ -553,6 +555,8 @@ def speak(speechSequence,symbolLevel=None):
# After normalisation, the sequence is empty.
# There's nothing to speak.
return
import inputCore
inputCore.logTimeSinceInput()
log.io("Speaking %r" % speechSequence)
if symbolLevel is None:
symbolLevel=config.conf["speech"]["symbolLevel"]
Expand Down