Skip to content

Commit

Permalink
UI Automation in Windows Console: make speaking of passwords configur…
Browse files Browse the repository at this point in the history
…able (#9649)

* Don't speak off-screen text (like passwords) in console windows.

This approach works on my system, but needs wider testing.

* Speaking of passwords is now configurable in UIA consoles, add accelerators for UIA console options in the GUI.

* Clarify user guide.

* Allow the password toggle to be restored.
  • Loading branch information
codeofdusk authored and michaelDCurran committed Jun 5, 2019
1 parent a74796f commit 4ff3172
Show file tree
Hide file tree
Showing 4 changed files with 34 additions and 2 deletions.
20 changes: 19 additions & 1 deletion source/NVDAObjects/UIA/winConsoleUIA.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@
# See the file COPYING for more details.
# Copyright (C) 2019 Bill Dengler

import config
import speech
import time
import textInfos
Expand Down Expand Up @@ -37,6 +38,7 @@ class winConsoleUIA(Terminal):
_TextInfo = consoleUIATextInfo
_isTyping = False
_lastCharTime = 0
_queuedChars = []
_TYPING_TIMEOUT = 1

def _reportNewText(self, line):
Expand All @@ -56,7 +58,22 @@ def event_typedCharacter(self, ch):
# This will need to be changed once #8110 is merged.
speech.curWordChars = []
self._lastCharTime = time.time()
super(winConsoleUIA, self).event_typedCharacter(ch)
if (
(
config.conf['keyboard']['speakTypedCharacters']
or config.conf['keyboard']['speakTypedWords']
)
and not config.conf['UIA']['winConsoleSpeakPasswords']
):
self._queuedChars.append(ch)
else:
super(winConsoleUIA, self).event_typedCharacter(ch)

def event_textChange(self):
while self._queuedChars:
ch = self._queuedChars.pop(0)
super(winConsoleUIA, self).event_typedCharacter(ch)
super(winConsoleUIA, self).event_textChange()

@script(gestures=[
"kb:enter",
Expand All @@ -69,6 +86,7 @@ def event_typedCharacter(self, ch):
def script_clear_isTyping(self, gesture):
gesture.send()
self._isTyping = False
self._queuedChars = []

def _getTextLines(self):
# Filter out extraneous empty lines from UIA
Expand Down
3 changes: 2 additions & 1 deletion source/config/configSpec.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
# -*- coding: UTF-8 -*-
#A part of NonVisual Desktop Access (NVDA)
#Copyright (C) 2006-2018 NV Access Limited, Babbage B.V., Davy Kager
#Copyright (C) 2006-2019 NV Access Limited, Babbage B.V., Davy Kager, Bill Dengler
#This file is covered by the GNU General Public License.
#See the file COPYING for more details.

Expand Down Expand Up @@ -188,6 +188,7 @@
enabled = boolean(default=true)
useInMSWordWhenAvailable = boolean(default=false)
winConsoleImplementation= option("auto", "legacy", "UIA", default="auto")
winConsoleSpeakPasswords = boolean(default=false)
[update]
autoCheck = boolean(default=true)
Expand Down
10 changes: 10 additions & 0 deletions source/gui/settingsDialogs.py
Original file line number Diff line number Diff line change
Expand Up @@ -2058,6 +2058,13 @@ def __init__(self, parent):
self.ConsoleUIACheckBox.SetValue(consoleUIADevMap)
self.ConsoleUIACheckBox.defaultValue = self._getDefaultValue(["UIA", "winConsoleImplementation"])

# Translators: This is the label for a checkbox in the
# Advanced settings panel.
label = _("Speak &passwords in UIA consoles (may improve performance)")
self.winConsoleSpeakPasswordsCheckBox=UIAGroup.addItem(wx.CheckBox(self, label=label))
self.winConsoleSpeakPasswordsCheckBox.SetValue(config.conf["UIA"]["winConsoleSpeakPasswords"])
self.winConsoleSpeakPasswordsCheckBox.defaultValue = self._getDefaultValue(["UIA", "winConsoleSpeakPasswords"])

# Translators: This is the label for a group of advanced options in the
# Advanced settings panel
label = _("Browse mode")
Expand Down Expand Up @@ -2143,6 +2150,7 @@ def haveConfigDefaultsBeenRestored(self):
self.scratchpadCheckBox.IsChecked() == self.scratchpadCheckBox.defaultValue and
self.UIAInMSWordCheckBox.IsChecked() == self.UIAInMSWordCheckBox.defaultValue and
self.ConsoleUIACheckBox.IsChecked() == (self.ConsoleUIACheckBox.defaultValue=='UIA') and
self.winConsoleSpeakPasswordsCheckBox.IsChecked() == self.winConsoleSpeakPasswordsCheckBox.defaultValue and
self.autoFocusFocusableElementsCheckBox.IsChecked() == self.autoFocusFocusableElementsCheckBox.defaultValue and
self.caretMoveTimeoutSpinControl.GetValue() == self.caretMoveTimeoutSpinControl.defaultValue and
set(self.logCategoriesList.CheckedItems) == set(self.logCategoriesList.defaultCheckedItems) and
Expand All @@ -2153,6 +2161,7 @@ def restoreToDefaults(self):
self.scratchpadCheckBox.SetValue(self.scratchpadCheckBox.defaultValue)
self.UIAInMSWordCheckBox.SetValue(self.UIAInMSWordCheckBox.defaultValue)
self.ConsoleUIACheckBox.SetValue(self.ConsoleUIACheckBox.defaultValue=='UIA')
self.winConsoleSpeakPasswordsCheckBox.SetValue(self.winConsoleSpeakPasswordsCheckBox.defaultValue)
self.autoFocusFocusableElementsCheckBox.SetValue(self.autoFocusFocusableElementsCheckBox.defaultValue)
self.caretMoveTimeoutSpinControl.SetValue(self.caretMoveTimeoutSpinControl.defaultValue)
self.logCategoriesList.CheckedItems = self.logCategoriesList.defaultCheckedItems
Expand All @@ -2166,6 +2175,7 @@ def onSave(self):
config.conf['UIA']['winConsoleImplementation'] = "UIA"
else:
config.conf['UIA']['winConsoleImplementation'] = "auto"
config.conf["UIA"]["winConsoleSpeakPasswords"]=self.winConsoleSpeakPasswordsCheckBox.IsChecked()
config.conf["virtualBuffers"]["autoFocusFocusableElements"] = self.autoFocusFocusableElementsCheckBox.IsChecked()
config.conf["editableText"]["caretMoveTimeoutMs"]=self.caretMoveTimeoutSpinControl.GetValue()
for index,key in enumerate(self.logCategories):
Expand Down
3 changes: 3 additions & 0 deletions user_docs/en/userGuide.t2t
Original file line number Diff line number Diff line change
Expand Up @@ -1674,6 +1674,9 @@ We still do not recommend that the majority of users turn this on by default, t
==== Force UI Automation in the Windows Console====[AdvancedSettingsConsoleUIA]
When this option is enabled, NVDA will use a new, work in progress version of its support for Windows Console which takes advantage of [accessibility improvements made by Microsoft https://devblogs.microsoft.com/commandline/whats-new-in-windows-console-in-windows-10-fall-creators-update/]. This feature is highly experimental and is still incomplete, so its use is not yet recommended. However, once completed, it is anticipated that this new support will become the default, improving NVDA's performance and stability in Windows command consoles.

==== Speak passwords in UIA consoles ====[AdvancedSettingsWinConsoleSpeakPasswords]
This setting controls whether characters are spoken by [speak typed characters #KeyboardSettingsSpeakTypedCharacters] or [speak typed words #KeyboardSettingsSpeakTypedWords] in situations where the screen does not update (such as password entry) in the Windows Console with UI automation support enabled. For security purposes, this setting should be left disabled. However, you may wish to enable it if you experience performance issues or instability with typed character and/or word reporting while using NVDA's new experimental console support.

==== Automatically set system focus to focusable elements in Browse Mode ====[BrowseModeSettingsAutoFocusFocusableElements]
Key: NVDA+8

Expand Down

0 comments on commit 4ff3172

Please sign in to comment.