From 9e2f8ad4360fc73e534dd24c5d1a9fe885da1358 Mon Sep 17 00:00:00 2001 From: Bill Dengler Date: Mon, 17 Jun 2019 22:40:06 -0400 Subject: [PATCH 01/14] Implement UIA console auto-detection. --- source/NVDAObjects/UIA/__init__.py | 2 +- source/UIAUtils.py | 12 +++++++++++- source/_UIAHandler.py | 5 ++++- 3 files changed, 16 insertions(+), 3 deletions(-) diff --git a/source/NVDAObjects/UIA/__init__.py b/source/NVDAObjects/UIA/__init__.py index f4479ca8429..01d96f05955 100644 --- a/source/NVDAObjects/UIA/__init__.py +++ b/source/NVDAObjects/UIA/__init__.py @@ -861,7 +861,7 @@ def findOverlayClasses(self,clsList): # Support Windows Console's UIA interface if ( self.windowClassName == "ConsoleWindowClass" - and config.conf['UIA']['winConsoleImplementation'] == "UIA" + and shouldUseUIAConsole() ): from . import winConsoleUIA winConsoleUIA.findExtraOverlayClasses(self, clsList) diff --git a/source/UIAUtils.py b/source/UIAUtils.py index 7704b12aa2d..567ffdbe6cc 100644 --- a/source/UIAUtils.py +++ b/source/UIAUtils.py @@ -1,12 +1,14 @@ #A part of NonVisual Desktop Access (NVDA) -#Copyright (C) 2015-2016 NV Access Limited +#Copyright (C) 2015-2019 NV Access Limited, Bill Dengler #This file is covered by the GNU General Public License. #See the file COPYING for more details. import operator from comtypes import COMError +import config import ctypes import UIAHandler +from winVersion import isWin10 def createUIAMultiPropertyCondition(*dicts): """ @@ -203,3 +205,11 @@ def getValue(self,ID,ignoreMixedValues=False): raise UIAMixedAttributeError return val +def shouldUseUIAConsole(): + "Determines whether to use UIA in the Windows Console." + setting = config.conf['UIA']['winConsoleImplementation'] + if setting == "legacy": + return False + elif setting == "UIA": + return True + return isWin10(1809) and not isWin10(1903, atLeast=False) diff --git a/source/_UIAHandler.py b/source/_UIAHandler.py index 91209981952..245b174171f 100644 --- a/source/_UIAHandler.py +++ b/source/_UIAHandler.py @@ -355,7 +355,10 @@ def _isBadUIAWindowClassName(self, windowClass): "Given a windowClassName, returns True if this is a known problematic UIA implementation." # #7497: Windows 10 Fall Creators Update has an incomplete UIA implementation for console windows, therefore for now we should ignore it. # It does not implement caret/selection, and probably has no new text events. - if windowClass == "ConsoleWindowClass" and config.conf['UIA']['winConsoleImplementation'] != "UIA": + if ( + windowClass == "ConsoleWindowClass" + and not UIAUtils.shouldUseUIAConsole() + ): return True return windowClass in badUIAWindowClassNames From 3adfe36885f0527b664b3327543954984e3e71ae Mon Sep 17 00:00:00 2001 From: Bill Dengler Date: Tue, 18 Jun 2019 03:49:47 -0400 Subject: [PATCH 02/14] Fully enable console support configuration. --- source/gui/settingsDialogs.py | 54 ++++++++++++++++++++++++++--------- user_docs/en/userGuide.t2t | 11 +++++-- 2 files changed, 49 insertions(+), 16 deletions(-) diff --git a/source/gui/settingsDialogs.py b/source/gui/settingsDialogs.py index b4e26c0d93a..62cfdc9e7df 100644 --- a/source/gui/settingsDialogs.py +++ b/source/gui/settingsDialogs.py @@ -2050,13 +2050,36 @@ def __init__(self, parent): self.UIAInMSWordCheckBox.SetValue(config.conf["UIA"]["useInMSWordWhenAvailable"]) self.UIAInMSWordCheckBox.defaultValue = self._getDefaultValue(["UIA", "useInMSWordWhenAvailable"]) - # Translators: This is the label for a checkbox in the - # Advanced settings panel. - label = _("Use UI Automation to access the Windows Console when available") - consoleUIADevMap = True if config.conf['UIA']['winConsoleImplementation'] == 'UIA' else False - self.ConsoleUIACheckBox=UIAGroup.addItem(wx.CheckBox(self, label=label)) - self.ConsoleUIACheckBox.SetValue(consoleUIADevMap) - self.ConsoleUIACheckBox.defaultValue = self._getDefaultValue(["UIA", "winConsoleImplementation"]) + # Translators: This is the label for a combo box for selecting the + # active console implementation in the advanced settings panel. + # Choices are automatic, prefer UIA, and force legacy. + consoleComboText = _("Windoes C&onsole support:") + consoleChoices=[ + #Translators: A choice in a combo box in the advanced settings + # panel to have NVDA determine its Windows Console implementation + # automatically. + _("Automatic"), + #Translators: A choice in a combo box in the advanced settings + # panel to have NVDA use UIA in the Windows Console when available. + _("Prefer UIA"), + #Translators: A choice in a combo box in the advanced settings + # panel to have NVDA use its legacy Windoes Console support + # in all cases. + _("Force legacy") + ] + self.consoleCombo = UIAGroup.addLabeledControl(consoleComboText, wx.Choice, choices=consoleChoices) + consoleValsToIndices = { + "auto": 0, + "UIA": 1, + "legacy": 2 + } + curChoice = consoleValsToIndices[ + config.conf['UIA']['winConsoleImplementation'] + ] + self.consoleCombo.SetSelection(curChoice) + self.consoleCombo.defaultValue = consoleValsToIndices[ + self._getDefaultValue(["UIA", "winConsoleImplementation"]) + ] # Translators: This is the label for a checkbox in the # Advanced settings panel. @@ -2149,7 +2172,7 @@ def haveConfigDefaultsBeenRestored(self): self._defaultsRestored and self.scratchpadCheckBox.IsChecked() == self.scratchpadCheckBox.defaultValue and self.UIAInMSWordCheckBox.IsChecked() == self.UIAInMSWordCheckBox.defaultValue and - self.ConsoleUIACheckBox.IsChecked() == (self.ConsoleUIACheckBox.defaultValue=='UIA') and + self.consoleCombo.GetSelection() == self.consoleCombo.defaultValue and self.winConsoleSpeakPasswordsCheckBox.IsChecked() == self.winConsoleSpeakPasswordsCheckBox.defaultValue and self.autoFocusFocusableElementsCheckBox.IsChecked() == self.autoFocusFocusableElementsCheckBox.defaultValue and self.caretMoveTimeoutSpinControl.GetValue() == self.caretMoveTimeoutSpinControl.defaultValue and @@ -2160,7 +2183,7 @@ def haveConfigDefaultsBeenRestored(self): def restoreToDefaults(self): self.scratchpadCheckBox.SetValue(self.scratchpadCheckBox.defaultValue) self.UIAInMSWordCheckBox.SetValue(self.UIAInMSWordCheckBox.defaultValue) - self.ConsoleUIACheckBox.SetValue(self.ConsoleUIACheckBox.defaultValue=='UIA') + self.consoleCombo.SetSelection(self.consoleCombo.defaultValue=='UIA') self.winConsoleSpeakPasswordsCheckBox.SetValue(self.winConsoleSpeakPasswordsCheckBox.defaultValue) self.autoFocusFocusableElementsCheckBox.SetValue(self.autoFocusFocusableElementsCheckBox.defaultValue) self.caretMoveTimeoutSpinControl.SetValue(self.caretMoveTimeoutSpinControl.defaultValue) @@ -2171,10 +2194,15 @@ def onSave(self): log.debug("Saving advanced config") config.conf["development"]["enableScratchpadDir"]=self.scratchpadCheckBox.IsChecked() config.conf["UIA"]["useInMSWordWhenAvailable"]=self.UIAInMSWordCheckBox.IsChecked() - if self.ConsoleUIACheckBox.IsChecked(): - config.conf['UIA']['winConsoleImplementation'] = "UIA" - else: - config.conf['UIA']['winConsoleImplementation'] = "auto" + consoleChoice = self.consoleCombo.GetSelection() + consoleIndicesToVals = { + 0: "auto", + 1: "UIA", + 2: "legacy" + } + config.conf['UIA']['winConsoleImplementation'] = ( + consoleIndicesToVals[consoleChoice] + ) config.conf["UIA"]["winConsoleSpeakPasswords"]=self.winConsoleSpeakPasswordsCheckBox.IsChecked() config.conf["virtualBuffers"]["autoFocusFocusableElements"] = self.autoFocusFocusableElementsCheckBox.IsChecked() config.conf["editableText"]["caretMoveTimeoutMs"]=self.caretMoveTimeoutSpinControl.GetValue() diff --git a/user_docs/en/userGuide.t2t b/user_docs/en/userGuide.t2t index 42c0e6e94c5..1ad10a32be4 100644 --- a/user_docs/en/userGuide.t2t +++ b/user_docs/en/userGuide.t2t @@ -1671,11 +1671,16 @@ This includes in Microsoft Word itself, and also the Microsoft Outlook message v However, There may be some information which is either not exposed, or exposed incorrectly in some versions of Microsoft Office, which means this UI automation support cannot always be relied upon. We still do not recommend that the majority of users turn this on by default, though we do welcome users of Office 2016/365 to test this feature and provide feedback. -==== Use UI Automation to access the Windows Console when available ====[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. +==== Windows Console support ====[AdvancedSettingsConsoleUIA] +This option selects how NVDA interacts with the Windows Console used by command prompt, PowerShell, and the Windows Subsystem for Linux. In Windows 10 version 1709, Microsoft [added support for its UI Automation API to the console https://devblogs.microsoft.com/commandline/whats-new-in-windows-console-in-windows-10-fall-creators-update/], bringing vastly improved performance and stability for screen readers that support it. In situations where UI Automation is unavailable or known to result in an inferior user experience, NVDA's legacy console support is available as a fallback. +The Windows Console support combo box has three options: +- Automatic: Uses UI Automation in consoles on Windows 10 version 1809 and later, except 1903. This option is recommended and set by default. +- Prefer UIA: Uses UI Automation in consoles if available, even on Windows versions with incomplete or buggy implementations. While this limited functionality may be useful (and even sufficient for your usage), use of this option is entirely at your own risk and no support for it will be provided. +- Force legacy: UI Automation in the Windows Console will be completely disabled, so the legacy fallback will always be used. +- ==== 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. +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 in consoles. ==== Automatically set system focus to focusable elements in Browse Mode ====[BrowseModeSettingsAutoFocusFocusableElements] Key: NVDA+8 From 1d7c86a44d4c65093dd3c13cef1c20e2e04a8061 Mon Sep 17 00:00:00 2001 From: Bill Dengler Date: Tue, 18 Jun 2019 18:10:31 -0400 Subject: [PATCH 03/14] Review actions. --- source/UIAUtils.py | 12 +++++++--- source/_UIAHandler.py | 2 -- source/gui/settingsDialogs.py | 45 ++++++++++++++++++++++------------- 3 files changed, 37 insertions(+), 22 deletions(-) diff --git a/source/UIAUtils.py b/source/UIAUtils.py index 567ffdbe6cc..4718e5c1b6b 100644 --- a/source/UIAUtils.py +++ b/source/UIAUtils.py @@ -205,11 +205,17 @@ def getValue(self,ID,ignoreMixedValues=False): raise UIAMixedAttributeError return val -def shouldUseUIAConsole(): - "Determines whether to use UIA in the Windows Console." - setting = config.conf['UIA']['winConsoleImplementation'] +def shouldUseUIAConsole(setting=None): + """Determines whether to use UIA in the Windows Console. +@param setting: the config value to base this check on (if not provided, +it is retrieved from config). + """ + if not setting: + setting = config.conf['UIA']['winConsoleImplementation'] if setting == "legacy": return False elif setting == "UIA": return True + # #7497: Windows 10 Fall Creators Update has an incomplete UIA implementation for console windows, therefore for now we should ignore it. + # It does not implement caret/selection, and probably has no new text events. return isWin10(1809) and not isWin10(1903, atLeast=False) diff --git a/source/_UIAHandler.py b/source/_UIAHandler.py index 245b174171f..e7a1b876ece 100644 --- a/source/_UIAHandler.py +++ b/source/_UIAHandler.py @@ -353,8 +353,6 @@ def IUIAutomationNotificationEventHandler_HandleNotificationEvent(self,sender,No def _isBadUIAWindowClassName(self, windowClass): "Given a windowClassName, returns True if this is a known problematic UIA implementation." - # #7497: Windows 10 Fall Creators Update has an incomplete UIA implementation for console windows, therefore for now we should ignore it. - # It does not implement caret/selection, and probably has no new text events. if ( windowClass == "ConsoleWindowClass" and not UIAUtils.shouldUseUIAConsole() diff --git a/source/gui/settingsDialogs.py b/source/gui/settingsDialogs.py index 62cfdc9e7df..842dce0f7f5 100644 --- a/source/gui/settingsDialogs.py +++ b/source/gui/settingsDialogs.py @@ -42,6 +42,7 @@ import inputCore from . import nvdaControls from driverHandler import * +from UIAUtils import shouldUseUIAConsole import touchHandler import winVersion import weakref @@ -2053,7 +2054,7 @@ def __init__(self, parent): # Translators: This is the label for a combo box for selecting the # active console implementation in the advanced settings panel. # Choices are automatic, prefer UIA, and force legacy. - consoleComboText = _("Windoes C&onsole support:") + consoleComboText = _("Windows C&onsole support:") consoleChoices=[ #Translators: A choice in a combo box in the advanced settings # panel to have NVDA determine its Windows Console implementation @@ -2067,26 +2068,34 @@ def __init__(self, parent): # in all cases. _("Force legacy") ] + #: The possible console config values, in the order they appear + #: in the combo box. + self.consoleVals = ( + "auto", + "UIA", + "legacy" + ) self.consoleCombo = UIAGroup.addLabeledControl(consoleComboText, wx.Choice, choices=consoleChoices) - consoleValsToIndices = { - "auto": 0, - "UIA": 1, - "legacy": 2 - } - curChoice = consoleValsToIndices[ + self.consoleCombo.Bind( + wx.EVT_CHOICE, + self.enableConsolePasswordsCheckBox, + self.consoleCombo + ) + curChoice = self.consoleVals.index( config.conf['UIA']['winConsoleImplementation'] - ] + ) self.consoleCombo.SetSelection(curChoice) - self.consoleCombo.defaultValue = consoleValsToIndices[ + self.consoleCombo.defaultValue = self.consoleVals.index( 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)") + label = _("Speak &passwords in Windows Console (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"]) + self.enableConsolePasswordsCheckBox() # Translators: This is the label for a group of advanced options in the # Advanced settings panel @@ -2160,6 +2169,13 @@ def __init__(self, parent): ] self.Layout() + def enableConsolePasswordsCheckBox(self, evt=None): + return self.winConsoleSpeakPasswordsCheckBox.Enable( + shouldUseUIAConsole(self.consoleVals[ + self.consoleCombo.GetSelection() + ]) + ) + def onOpenScratchpadDir(self,evt): path=config.getScratchpadDir(ensureExists=True) os.startfile(path) @@ -2195,13 +2211,8 @@ def onSave(self): config.conf["development"]["enableScratchpadDir"]=self.scratchpadCheckBox.IsChecked() config.conf["UIA"]["useInMSWordWhenAvailable"]=self.UIAInMSWordCheckBox.IsChecked() consoleChoice = self.consoleCombo.GetSelection() - consoleIndicesToVals = { - 0: "auto", - 1: "UIA", - 2: "legacy" - } config.conf['UIA']['winConsoleImplementation'] = ( - consoleIndicesToVals[consoleChoice] + self.consoleVals[consoleChoice] ) config.conf["UIA"]["winConsoleSpeakPasswords"]=self.winConsoleSpeakPasswordsCheckBox.IsChecked() config.conf["virtualBuffers"]["autoFocusFocusableElements"] = self.autoFocusFocusableElementsCheckBox.IsChecked() From 48772429c2a1b86d85ad4d12626cd430a0cffde8 Mon Sep 17 00:00:00 2001 From: Bill Dengler Date: Tue, 18 Jun 2019 18:14:26 -0400 Subject: [PATCH 04/14] Update user guide. --- user_docs/en/userGuide.t2t | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-) diff --git a/user_docs/en/userGuide.t2t b/user_docs/en/userGuide.t2t index 1ad10a32be4..fc0a5f120c4 100644 --- a/user_docs/en/userGuide.t2t +++ b/user_docs/en/userGuide.t2t @@ -1672,15 +1672,19 @@ However, There may be some information which is either not exposed, or exposed i We still do not recommend that the majority of users turn this on by default, though we do welcome users of Office 2016/365 to test this feature and provide feedback. ==== Windows Console support ====[AdvancedSettingsConsoleUIA] -This option selects how NVDA interacts with the Windows Console used by command prompt, PowerShell, and the Windows Subsystem for Linux. In Windows 10 version 1709, Microsoft [added support for its UI Automation API to the console https://devblogs.microsoft.com/commandline/whats-new-in-windows-console-in-windows-10-fall-creators-update/], bringing vastly improved performance and stability for screen readers that support it. In situations where UI Automation is unavailable or known to result in an inferior user experience, NVDA's legacy console support is available as a fallback. +This option selects how NVDA interacts with the Windows Console used by command prompt, PowerShell, and the Windows Subsystem for Linux. +In Windows 10 version 1709, Microsoft [added support for its UI Automation API to the console https://devblogs.microsoft.com/commandline/whats-new-in-windows-console-in-windows-10-fall-creators-update/], bringing vastly improved performance and stability for screen readers that support it. +In situations where UI Automation is unavailable or known to result in an inferior user experience, NVDA's legacy console support is available as a fallback. The Windows Console support combo box has three options: - Automatic: Uses UI Automation in consoles on Windows 10 version 1809 and later, except 1903. This option is recommended and set by default. - Prefer UIA: Uses UI Automation in consoles if available, even on Windows versions with incomplete or buggy implementations. While this limited functionality may be useful (and even sufficient for your usage), use of this option is entirely at your own risk and no support for it will be provided. - Force legacy: UI Automation in the Windows Console will be completely disabled, so the legacy fallback will always be used. - -==== 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 in consoles. +==== Speak passwords in Windows Console ====[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 in consoles, or are working in secure environments and prefer password announcement. ==== Automatically set system focus to focusable elements in Browse Mode ====[BrowseModeSettingsAutoFocusFocusableElements] Key: NVDA+8 From 322cd0334300776dd5a3e96d3e3f6aa567e103a1 Mon Sep 17 00:00:00 2001 From: Bill Dengler Date: Tue, 18 Jun 2019 18:17:14 -0400 Subject: [PATCH 05/14] Update user guide. --- user_docs/en/userGuide.t2t | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/user_docs/en/userGuide.t2t b/user_docs/en/userGuide.t2t index fc0a5f120c4..bb4e6ac9126 100644 --- a/user_docs/en/userGuide.t2t +++ b/user_docs/en/userGuide.t2t @@ -1684,7 +1684,7 @@ The Windows Console support combo box has three options: ==== Speak passwords in Windows Console ====[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 in consoles, or are working in secure environments and prefer password announcement. +However, you may wish to enable it if you experience performance issues or instability with typed character and/or word reporting in consoles, or work in secure environments and prefer password announcement. ==== Automatically set system focus to focusable elements in Browse Mode ====[BrowseModeSettingsAutoFocusFocusableElements] Key: NVDA+8 From 9e2e9daa55f1839529dd437b49f8017d243c794b Mon Sep 17 00:00:00 2001 From: Bill Dengler Date: Wed, 19 Jun 2019 00:38:24 -0400 Subject: [PATCH 06/14] Enable UIA console on Windows 10 1903 and later. --- source/UIAUtils.py | 2 +- user_docs/en/userGuide.t2t | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/source/UIAUtils.py b/source/UIAUtils.py index 4718e5c1b6b..930e58b8449 100644 --- a/source/UIAUtils.py +++ b/source/UIAUtils.py @@ -218,4 +218,4 @@ def shouldUseUIAConsole(setting=None): return True # #7497: Windows 10 Fall Creators Update has an incomplete UIA implementation for console windows, therefore for now we should ignore it. # It does not implement caret/selection, and probably has no new text events. - return isWin10(1809) and not isWin10(1903, atLeast=False) + return isWin10(1809) diff --git a/user_docs/en/userGuide.t2t b/user_docs/en/userGuide.t2t index bb4e6ac9126..c31856ecec8 100644 --- a/user_docs/en/userGuide.t2t +++ b/user_docs/en/userGuide.t2t @@ -1676,7 +1676,7 @@ This option selects how NVDA interacts with the Windows Console used by command In Windows 10 version 1709, Microsoft [added support for its UI Automation API to the console https://devblogs.microsoft.com/commandline/whats-new-in-windows-console-in-windows-10-fall-creators-update/], bringing vastly improved performance and stability for screen readers that support it. In situations where UI Automation is unavailable or known to result in an inferior user experience, NVDA's legacy console support is available as a fallback. The Windows Console support combo box has three options: -- Automatic: Uses UI Automation in consoles on Windows 10 version 1809 and later, except 1903. This option is recommended and set by default. +- Automatic: Uses UI Automation in consoles on Windows 10 version 1809 and later. This option is recommended and set by default. - Prefer UIA: Uses UI Automation in consoles if available, even on Windows versions with incomplete or buggy implementations. While this limited functionality may be useful (and even sufficient for your usage), use of this option is entirely at your own risk and no support for it will be provided. - Force legacy: UI Automation in the Windows Console will be completely disabled, so the legacy fallback will always be used. - From ea43baac3cc6bb0c3c2c9752cec491c0bb009b3c Mon Sep 17 00:00:00 2001 From: Bill Dengler Date: Mon, 24 Jun 2019 21:41:53 -0400 Subject: [PATCH 07/14] Always use custom collapse logic and set minimum version to 1803. --- source/NVDAObjects/UIA/winConsoleUIA.py | 9 ++------- source/UIAUtils.py | 2 +- 2 files changed, 3 insertions(+), 8 deletions(-) diff --git a/source/NVDAObjects/UIA/winConsoleUIA.py b/source/NVDAObjects/UIA/winConsoleUIA.py index 7a293af5ccc..7922029ddd8 100644 --- a/source/NVDAObjects/UIA/winConsoleUIA.py +++ b/source/NVDAObjects/UIA/winConsoleUIA.py @@ -13,7 +13,6 @@ import UIAHandler from scriptHandler import script -from winVersion import isWin10 from . import UIATextInfo from ..behaviors import Terminal from ..window import Window @@ -27,9 +26,7 @@ class consoleUIATextInfo(UIATextInfo): _expandCollapseBeforeReview = False def collapse(self,end=False): - """Works around a UIA bug on Windows 10 1903 and later.""" - if not isWin10(1903): - return super(consoleUIATextInfo, self).collapse(end=end) + """Works around a UIA bug on Windows 10 1803 and later.""" # When collapsing, consoles seem to incorrectly push the start of the # textRange back one character. # Correct this by bringing the start back up to where the end is. @@ -146,9 +143,7 @@ def expand(self, unit): return super(consoleUIATextInfo, self).expand(unit) def _get_isCollapsed(self): - """Works around a UIA bug on Windows 10 1903 and later.""" - if not isWin10(1903): - return super(consoleUIATextInfo, self)._get_isCollapsed() + """Works around a UIA bug on Windows 10 1803 and later.""" # Even when a console textRange's start and end have been moved to the # same position, the console incorrectly reports the end as being # past the start. diff --git a/source/UIAUtils.py b/source/UIAUtils.py index 930e58b8449..5b3bea7252b 100644 --- a/source/UIAUtils.py +++ b/source/UIAUtils.py @@ -218,4 +218,4 @@ def shouldUseUIAConsole(setting=None): return True # #7497: Windows 10 Fall Creators Update has an incomplete UIA implementation for console windows, therefore for now we should ignore it. # It does not implement caret/selection, and probably has no new text events. - return isWin10(1809) + return isWin10(1803) From 79e2aed000d17b2078d624d43664688ec4f325f2 Mon Sep 17 00:00:00 2001 From: Bill Dengler Date: Mon, 24 Jun 2019 21:47:23 -0400 Subject: [PATCH 08/14] Update user guide. --- user_docs/en/userGuide.t2t | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/user_docs/en/userGuide.t2t b/user_docs/en/userGuide.t2t index c31856ecec8..136aa45e1bd 100644 --- a/user_docs/en/userGuide.t2t +++ b/user_docs/en/userGuide.t2t @@ -1676,7 +1676,7 @@ This option selects how NVDA interacts with the Windows Console used by command In Windows 10 version 1709, Microsoft [added support for its UI Automation API to the console https://devblogs.microsoft.com/commandline/whats-new-in-windows-console-in-windows-10-fall-creators-update/], bringing vastly improved performance and stability for screen readers that support it. In situations where UI Automation is unavailable or known to result in an inferior user experience, NVDA's legacy console support is available as a fallback. The Windows Console support combo box has three options: -- Automatic: Uses UI Automation in consoles on Windows 10 version 1809 and later. This option is recommended and set by default. +- Automatic: Uses UI Automation in consoles on Windows 10 version 1803 and later. This option is recommended and set by default. - Prefer UIA: Uses UI Automation in consoles if available, even on Windows versions with incomplete or buggy implementations. While this limited functionality may be useful (and even sufficient for your usage), use of this option is entirely at your own risk and no support for it will be provided. - Force legacy: UI Automation in the Windows Console will be completely disabled, so the legacy fallback will always be used. - From 21614ecec373daab1f19d25c938806822df1283f Mon Sep 17 00:00:00 2001 From: Bill Dengler Date: Wed, 3 Jul 2019 20:14:05 +0800 Subject: [PATCH 09/14] Review actions. --- source/gui/settingsDialogs.py | 4 ++-- user_docs/en/userGuide.t2t | 6 +++--- 2 files changed, 5 insertions(+), 5 deletions(-) diff --git a/source/gui/settingsDialogs.py b/source/gui/settingsDialogs.py index 842dce0f7f5..9fe000c4b3e 100644 --- a/source/gui/settingsDialogs.py +++ b/source/gui/settingsDialogs.py @@ -2053,7 +2053,7 @@ def __init__(self, parent): # Translators: This is the label for a combo box for selecting the # active console implementation in the advanced settings panel. - # Choices are automatic, prefer UIA, and force legacy. + # Choices are automatic, prefer UIA, and legacy. consoleComboText = _("Windows C&onsole support:") consoleChoices=[ #Translators: A choice in a combo box in the advanced settings @@ -2066,7 +2066,7 @@ def __init__(self, parent): #Translators: A choice in a combo box in the advanced settings # panel to have NVDA use its legacy Windoes Console support # in all cases. - _("Force legacy") + _("Legacy") ] #: The possible console config values, in the order they appear #: in the combo box. diff --git a/user_docs/en/userGuide.t2t b/user_docs/en/userGuide.t2t index 136aa45e1bd..85c0e84d604 100644 --- a/user_docs/en/userGuide.t2t +++ b/user_docs/en/userGuide.t2t @@ -1672,19 +1672,19 @@ However, There may be some information which is either not exposed, or exposed i We still do not recommend that the majority of users turn this on by default, though we do welcome users of Office 2016/365 to test this feature and provide feedback. ==== Windows Console support ====[AdvancedSettingsConsoleUIA] -This option selects how NVDA interacts with the Windows Console used by command prompt, PowerShell, and the Windows Subsystem for Linux. +This option selects how NVDA interacts with the Windows Console used by command prompt, PowerShell, and the Windows Subsystem for Linux. It does not affect the modern Windows Terminal. In Windows 10 version 1709, Microsoft [added support for its UI Automation API to the console https://devblogs.microsoft.com/commandline/whats-new-in-windows-console-in-windows-10-fall-creators-update/], bringing vastly improved performance and stability for screen readers that support it. In situations where UI Automation is unavailable or known to result in an inferior user experience, NVDA's legacy console support is available as a fallback. The Windows Console support combo box has three options: - Automatic: Uses UI Automation in consoles on Windows 10 version 1803 and later. This option is recommended and set by default. - Prefer UIA: Uses UI Automation in consoles if available, even on Windows versions with incomplete or buggy implementations. While this limited functionality may be useful (and even sufficient for your usage), use of this option is entirely at your own risk and no support for it will be provided. -- Force legacy: UI Automation in the Windows Console will be completely disabled, so the legacy fallback will always be used. +- Legacy: UI Automation in the Windows Console will be completely disabled, so the legacy fallback will always be used. - ==== Speak passwords in Windows Console ====[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 in consoles, or work in secure environments and prefer password announcement. +However, you may wish to enable it if you experience performance issues or instability with typed character and/or word reporting in consoles, or work in trusted environments and prefer password announcement. ==== Automatically set system focus to focusable elements in Browse Mode ====[BrowseModeSettingsAutoFocusFocusableElements] Key: NVDA+8 From 3ec9b3fc3089cfb0e7f76bd6e9644bdbe52a5149 Mon Sep 17 00:00:00 2001 From: Bill Dengler Date: Wed, 17 Jul 2019 02:54:38 +0800 Subject: [PATCH 10/14] Update user guide. --- user_docs/en/userGuide.t2t | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/user_docs/en/userGuide.t2t b/user_docs/en/userGuide.t2t index 85c0e84d604..0d27ab48fbd 100644 --- a/user_docs/en/userGuide.t2t +++ b/user_docs/en/userGuide.t2t @@ -1672,7 +1672,8 @@ However, There may be some information which is either not exposed, or exposed i We still do not recommend that the majority of users turn this on by default, though we do welcome users of Office 2016/365 to test this feature and provide feedback. ==== Windows Console support ====[AdvancedSettingsConsoleUIA] -This option selects how NVDA interacts with the Windows Console used by command prompt, PowerShell, and the Windows Subsystem for Linux. It does not affect the modern Windows Terminal. +This option selects how NVDA interacts with the Windows Console used by command prompt, PowerShell, and the Windows Subsystem for Linux. +It does not affect the modern Windows Terminal. In Windows 10 version 1709, Microsoft [added support for its UI Automation API to the console https://devblogs.microsoft.com/commandline/whats-new-in-windows-console-in-windows-10-fall-creators-update/], bringing vastly improved performance and stability for screen readers that support it. In situations where UI Automation is unavailable or known to result in an inferior user experience, NVDA's legacy console support is available as a fallback. The Windows Console support combo box has three options: From 6ce69215996898f5bddf6c521d3c4d102294c4c8 Mon Sep 17 00:00:00 2001 From: Bill Dengler Date: Thu, 1 Aug 2019 16:01:21 -0400 Subject: [PATCH 11/14] Move winConsoleSpeakPasswords option to terminal programs group. --- source/NVDAObjects/behaviors.py | 2 +- source/config/configSpec.py | 8 ++++---- source/config/profileUpgradeSteps.py | 12 ++++++++++++ source/gui/settingsDialogs.py | 25 ++++++++++++------------- 4 files changed, 29 insertions(+), 18 deletions(-) diff --git a/source/NVDAObjects/behaviors.py b/source/NVDAObjects/behaviors.py index 60a751439a3..5bf6b3dc6ea 100755 --- a/source/NVDAObjects/behaviors.py +++ b/source/NVDAObjects/behaviors.py @@ -413,7 +413,7 @@ def event_typedCharacter(self, ch): config.conf['keyboard']['speakTypedCharacters'] or config.conf['keyboard']['speakTypedWords'] ) - and not config.conf['UIA']['winConsoleSpeakPasswords'] + and not config.conf['terminals']['speakPasswords'] and self._supportsTextChange ): self._queuedChars.append(ch) diff --git a/source/config/configSpec.py b/source/config/configSpec.py index b33cebc9409..024c63959c1 100644 --- a/source/config/configSpec.py +++ b/source/config/configSpec.py @@ -11,11 +11,11 @@ #: provide an upgrade step (@see profileUpgradeSteps.py). An upgrade step does not need to be added when #: just adding a new element to (or removing from) the schema, only when old versions of the config #: (conforming to old schema versions) will not work correctly with the new schema. -latestSchemaVersion = 2 +latestSchemaVersion = 3 #: The configuration specification string #: @type: String -configSpecString = ("""# NVDA Configuration File +configSpecString = (f"""# NVDA Configuration File schemaVersion = integer(min=0, default={latestSchemaVersion}) [general] language = string(default="Windows") @@ -188,9 +188,9 @@ enabled = boolean(default=true) useInMSWordWhenAvailable = boolean(default=false) winConsoleImplementation= option("auto", "legacy", "UIA", default="auto") - winConsoleSpeakPasswords = boolean(default=false) [terminals] + speakPasswords = boolean(default=false) keyboardSupportInLegacy = boolean(default=True) [update] @@ -224,7 +224,7 @@ [development] enableScratchpadDir = boolean(default=false) -""").format(latestSchemaVersion=latestSchemaVersion) +""") #: The configuration specification #: @type: ConfigObj diff --git a/source/config/profileUpgradeSteps.py b/source/config/profileUpgradeSteps.py index 5dd4582a0a9..ba569af2d1c 100644 --- a/source/config/profileUpgradeSteps.py +++ b/source/config/profileUpgradeSteps.py @@ -45,3 +45,15 @@ def upgradeConfigFrom_1_to_2(profile): else: del profile["braille"]["cursorShape"] profile["braille"]["cursorShapeFocus"] = cursorShape + +def upgradeConfigFrom_2_to_3(profile): + # The winConsoleSpeakPasswords option has been moved to the terminals section of the config. + try: + speakPasswords = profile["UIA"]["winConsoleSpeakPasswords"] + except KeyError as e: + # Setting does not exist, no need for upgrade of this setting + log.debug("winConsoleSpeakPasswords not present, no action taken.") + pass + else: + del profile["UIA"]["winConsoleSpeakPasswords"] + profile["terminals"]["speakPasswords"] = speakPasswords diff --git a/source/gui/settingsDialogs.py b/source/gui/settingsDialogs.py index 163eda26abd..eff275a2b3a 100644 --- a/source/gui/settingsDialogs.py +++ b/source/gui/settingsDialogs.py @@ -1,7 +1,7 @@ # -*- coding: UTF-8 -*- #settingsDialogs.py #A part of NonVisual Desktop Access (NVDA) -#Copyright (C) 2006-2019 NV Access Limited, Peter Vágner, Aleksey Sadovoy, Rui Batista, Joseph Lee, Heiko Folkerts, Zahari Yurukov, Leonard de Ruijter, Derek Riemer, Babbage B.V., Davy Kager, Ethan Holliger +#Copyright (C) 2006-2019 NV Access Limited, Peter Vágner, Aleksey Sadovoy, Rui Batista, Joseph Lee, Heiko Folkerts, Zahari Yurukov, Leonard de Ruijter, Derek Riemer, Babbage B.V., Davy Kager, Ethan Holliger, Bill Dengler #This file is covered by the GNU General Public License. #See the file COPYING for more details. @@ -2092,14 +2092,6 @@ def __init__(self, parent): self._getDefaultValue(["UIA", "winConsoleImplementation"]) ) - # Translators: This is the label for a checkbox in the - # Advanced settings panel. - label = _("Speak &passwords in Windows Console (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"]) - self.enableConsolePasswordsCheckBox() - # Translators: This is the label for a group of advanced options in the # Advanced settings panel label = _("Terminal programs") @@ -2110,6 +2102,13 @@ def __init__(self, parent): sHelper.addItem(terminalsGroup) # Translators: This is the label for a checkbox in the # Advanced settings panel. + label = _("Speak &passwords in Windows Console (may improve performance)") + self.speakPasswordsCheckBox=terminalsGroup.addItem(wx.CheckBox(self, label=label)) + self.speakPasswordsCheckBox.SetValue(config.conf["terminals"]["speakPasswords"]) + self.speakPasswordsCheckBox.defaultValue = self._getDefaultValue(["terminals", "speakPasswords"]) + self.enableConsolePasswordsCheckBox() + # Translators: This is the label for a checkbox in the + # Advanced settings panel. label = _("Use the new t&yped character support in legacy Windows consoles when available") self.keyboardSupportInLegacyCheckBox=terminalsGroup.addItem(wx.CheckBox(self, label=label)) self.keyboardSupportInLegacyCheckBox.SetValue(config.conf["terminals"]["keyboardSupportInLegacy"]) @@ -2189,7 +2188,7 @@ def __init__(self, parent): self.Layout() def enableConsolePasswordsCheckBox(self, evt=None): - return self.winConsoleSpeakPasswordsCheckBox.Enable( + return self.speakPasswordsCheckBox.Enable( shouldUseUIAConsole(self.consoleVals[ self.consoleCombo.GetSelection() ]) @@ -2208,7 +2207,7 @@ def haveConfigDefaultsBeenRestored(self): self.scratchpadCheckBox.IsChecked() == self.scratchpadCheckBox.defaultValue and self.UIAInMSWordCheckBox.IsChecked() == self.UIAInMSWordCheckBox.defaultValue and self.consoleCombo.GetSelection() == self.consoleCombo.defaultValue and - self.winConsoleSpeakPasswordsCheckBox.IsChecked() == self.winConsoleSpeakPasswordsCheckBox.defaultValue and + self.speakPasswordsCheckBox.IsChecked() == self.speakPasswordsCheckBox.defaultValue and self.keyboardSupportInLegacyCheckBox.IsChecked() == self.keyboardSupportInLegacyCheckBox.defaultValue and self.autoFocusFocusableElementsCheckBox.IsChecked() == self.autoFocusFocusableElementsCheckBox.defaultValue and self.caretMoveTimeoutSpinControl.GetValue() == self.caretMoveTimeoutSpinControl.defaultValue and @@ -2220,7 +2219,7 @@ def restoreToDefaults(self): self.scratchpadCheckBox.SetValue(self.scratchpadCheckBox.defaultValue) self.UIAInMSWordCheckBox.SetValue(self.UIAInMSWordCheckBox.defaultValue) self.consoleCombo.SetSelection(self.consoleCombo.defaultValue=='UIA') - self.winConsoleSpeakPasswordsCheckBox.SetValue(self.winConsoleSpeakPasswordsCheckBox.defaultValue) + self.speakPasswordsCheckBox.SetValue(self.speakPasswordsCheckBox.defaultValue) self.keyboardSupportInLegacyCheckBox.SetValue(self.keyboardSupportInLegacyCheckBox.defaultValue) self.autoFocusFocusableElementsCheckBox.SetValue(self.autoFocusFocusableElementsCheckBox.defaultValue) self.caretMoveTimeoutSpinControl.SetValue(self.caretMoveTimeoutSpinControl.defaultValue) @@ -2235,7 +2234,7 @@ def onSave(self): config.conf['UIA']['winConsoleImplementation'] = ( self.consoleVals[consoleChoice] ) - config.conf["UIA"]["winConsoleSpeakPasswords"]=self.winConsoleSpeakPasswordsCheckBox.IsChecked() + config.conf["terminals"]["speakPasswords"]=self.speakPasswordsCheckBox.IsChecked() config.conf["terminals"]["keyboardSupportInLegacy"]=self.keyboardSupportInLegacyCheckBox.IsChecked() config.conf["virtualBuffers"]["autoFocusFocusableElements"] = self.autoFocusFocusableElementsCheckBox.IsChecked() config.conf["editableText"]["caretMoveTimeoutMs"]=self.caretMoveTimeoutSpinControl.GetValue() From fb4961bcf8cd709eb8318fd610ea45d2b7ca0bdd Mon Sep 17 00:00:00 2001 From: Bill Dengler Date: Thu, 1 Aug 2019 16:07:22 -0400 Subject: [PATCH 12/14] Update user guide. --- user_docs/en/userGuide.t2t | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/user_docs/en/userGuide.t2t b/user_docs/en/userGuide.t2t index f6b10b35e20..7f7759b6b1a 100644 --- a/user_docs/en/userGuide.t2t +++ b/user_docs/en/userGuide.t2t @@ -1698,7 +1698,7 @@ The Windows Console support combo box has three options: - ==== Speak passwords in Windows Console ====[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. +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 some terminal programs, such as the Windows Console with UI automation support enabled and Mintty. 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 in consoles, or work in trusted environments and prefer password announcement. From fc801118de36f459f5ff33b1b89fe01aa98000ea Mon Sep 17 00:00:00 2001 From: Bill Dengler Date: Thu, 1 Aug 2019 16:34:07 -0400 Subject: [PATCH 13/14] Style. --- source/NVDAObjects/UIA/winConsoleUIA.py | 17 ++++++++--------- source/UIAUtils.py | 16 ++++++++++------ source/config/profileUpgradeSteps.py | 3 ++- source/gui/settingsDialogs.py | 24 ++++++++++++------------ 4 files changed, 32 insertions(+), 28 deletions(-) diff --git a/source/NVDAObjects/UIA/winConsoleUIA.py b/source/NVDAObjects/UIA/winConsoleUIA.py index 945a54f5dc5..b7f0c750cc0 100644 --- a/source/NVDAObjects/UIA/winConsoleUIA.py +++ b/source/NVDAObjects/UIA/winConsoleUIA.py @@ -11,7 +11,6 @@ from comtypes import COMError from UIAUtils import isTextRangeOffscreen -from winVersion import isWin10 from . import UIATextInfo from ..behaviors import KeyboardHandlerBasedTypedCharSupport from ..window import Window @@ -24,28 +23,28 @@ class consoleUIATextInfo(UIATextInfo): #: to do much good either. _expandCollapseBeforeReview = False - def __init__(self,obj,position,_rangeObj=None): + def __init__(self, obj, position, _rangeObj=None): super(consoleUIATextInfo, self).__init__(obj, position, _rangeObj) # Re-implement POSITION_FIRST and POSITION_LAST in terms of # visible ranges to fix review top/bottom scripts. - if position==textInfos.POSITION_FIRST: + if position == textInfos.POSITION_FIRST: visiRanges = self.obj.UIATextPattern.GetVisibleRanges() firstVisiRange = visiRanges.GetElement(0) self._rangeObj = firstVisiRange self.collapse() - elif position==textInfos.POSITION_LAST: + elif position == textInfos.POSITION_LAST: visiRanges = self.obj.UIATextPattern.GetVisibleRanges() lastVisiRange = visiRanges.GetElement(visiRanges.length - 1) self._rangeObj = lastVisiRange self.collapse(True) - def collapse(self,end=False): + def collapse(self, end=False): """Works around a UIA bug on Windows 10 1803 and later.""" # When collapsing, consoles seem to incorrectly push the start of the # textRange back one character. # Correct this by bringing the start back up to where the end is. - oldInfo=self.copy() - super(consoleUIATextInfo,self).collapse(end=end) + oldInfo = self.copy() + super(consoleUIATextInfo, self).collapse(end=end) if not end: self._rangeObj.MoveEndpointByRange( UIAHandler.TextPatternRangeEndpoint_Start, @@ -211,9 +210,9 @@ def _getWordOffsetsInThisLine(self, offset, lineInfo): min(end.value, max(1, len(lineText) - 2)) ) - def __ne__(self,other): + def __ne__(self, other): """Support more accurate caret move detection.""" - return not self==other + return not self == other class consoleUIAWindow(Window): diff --git a/source/UIAUtils.py b/source/UIAUtils.py index b1c690fdbf0..cacd8e20ed1 100644 --- a/source/UIAUtils.py +++ b/source/UIAUtils.py @@ -1,7 +1,7 @@ -#A part of NonVisual Desktop Access (NVDA) -#Copyright (C) 2015-2019 NV Access Limited, Bill Dengler -#This file is covered by the GNU General Public License. -#See the file COPYING for more details. +# A part of NonVisual Desktop Access (NVDA) +# Copyright (C) 2015-2019 NV Access Limited, Bill Dengler +# This file is covered by the GNU General Public License. +# See the file COPYING for more details. import operator from comtypes import COMError @@ -222,6 +222,7 @@ def getValue(self,ID,ignoreMixedValues=False): raise UIAMixedAttributeError return val + def shouldUseUIAConsole(setting=None): """Determines whether to use UIA in the Windows Console. @param setting: the config value to base this check on (if not provided, @@ -233,6 +234,9 @@ def shouldUseUIAConsole(setting=None): return False elif setting == "UIA": return True - # #7497: Windows 10 Fall Creators Update has an incomplete UIA implementation for console windows, therefore for now we should ignore it. - # It does not implement caret/selection, and probably has no new text events. + # #7497: Windows 10 Fall Creators Update has an incomplete UIA + # implementation for console windows, therefore for now we should + # ignore it. + # It does not implement caret/selection, and probably has no + # new text events. return isWin10(1803) diff --git a/source/config/profileUpgradeSteps.py b/source/config/profileUpgradeSteps.py index ba569af2d1c..3f22a0611cc 100644 --- a/source/config/profileUpgradeSteps.py +++ b/source/config/profileUpgradeSteps.py @@ -46,11 +46,12 @@ def upgradeConfigFrom_1_to_2(profile): del profile["braille"]["cursorShape"] profile["braille"]["cursorShapeFocus"] = cursorShape + def upgradeConfigFrom_2_to_3(profile): # The winConsoleSpeakPasswords option has been moved to the terminals section of the config. try: speakPasswords = profile["UIA"]["winConsoleSpeakPasswords"] - except KeyError as e: + except KeyError: # Setting does not exist, no need for upgrade of this setting log.debug("winConsoleSpeakPasswords not present, no action taken.") pass diff --git a/source/gui/settingsDialogs.py b/source/gui/settingsDialogs.py index eff275a2b3a..fcc41b784ae 100644 --- a/source/gui/settingsDialogs.py +++ b/source/gui/settingsDialogs.py @@ -1,9 +1,9 @@ # -*- coding: UTF-8 -*- -#settingsDialogs.py -#A part of NonVisual Desktop Access (NVDA) -#Copyright (C) 2006-2019 NV Access Limited, Peter Vágner, Aleksey Sadovoy, Rui Batista, Joseph Lee, Heiko Folkerts, Zahari Yurukov, Leonard de Ruijter, Derek Riemer, Babbage B.V., Davy Kager, Ethan Holliger, Bill Dengler -#This file is covered by the GNU General Public License. -#See the file COPYING for more details. +# settingsDialogs.py +# A part of NonVisual Desktop Access (NVDA) +# Copyright (C) 2006-2019 NV Access Limited, Peter Vágner, Aleksey Sadovoy, Rui Batista, Joseph Lee, Heiko Folkerts, Zahari Yurukov, Leonard de Ruijter, Derek Riemer, Babbage B.V., Davy Kager, Ethan Holliger, Bill Dengler +# This file is covered by the GNU General Public License. +# See the file COPYING for more details. import logging from abc import abstractmethod @@ -2058,15 +2058,15 @@ def __init__(self, parent): # active console implementation in the advanced settings panel. # Choices are automatic, prefer UIA, and legacy. consoleComboText = _("Windows C&onsole support:") - consoleChoices=[ - #Translators: A choice in a combo box in the advanced settings + consoleChoices = [ + # Translators: A choice in a combo box in the advanced settings # panel to have NVDA determine its Windows Console implementation # automatically. _("Automatic"), - #Translators: A choice in a combo box in the advanced settings + # Translators: A choice in a combo box in the advanced settings # panel to have NVDA use UIA in the Windows Console when available. _("Prefer UIA"), - #Translators: A choice in a combo box in the advanced settings + # Translators: A choice in a combo box in the advanced settings # panel to have NVDA use its legacy Windoes Console support # in all cases. _("Legacy") @@ -2103,7 +2103,7 @@ def __init__(self, parent): # Translators: This is the label for a checkbox in the # Advanced settings panel. label = _("Speak &passwords in Windows Console (may improve performance)") - self.speakPasswordsCheckBox=terminalsGroup.addItem(wx.CheckBox(self, label=label)) + self.speakPasswordsCheckBox = terminalsGroup.addItem(wx.CheckBox(self, label=label)) self.speakPasswordsCheckBox.SetValue(config.conf["terminals"]["speakPasswords"]) self.speakPasswordsCheckBox.defaultValue = self._getDefaultValue(["terminals", "speakPasswords"]) self.enableConsolePasswordsCheckBox() @@ -2218,7 +2218,7 @@ def haveConfigDefaultsBeenRestored(self): def restoreToDefaults(self): self.scratchpadCheckBox.SetValue(self.scratchpadCheckBox.defaultValue) self.UIAInMSWordCheckBox.SetValue(self.UIAInMSWordCheckBox.defaultValue) - self.consoleCombo.SetSelection(self.consoleCombo.defaultValue=='UIA') + self.consoleCombo.SetSelection(self.consoleCombo.defaultValue == 'UIA') self.speakPasswordsCheckBox.SetValue(self.speakPasswordsCheckBox.defaultValue) self.keyboardSupportInLegacyCheckBox.SetValue(self.keyboardSupportInLegacyCheckBox.defaultValue) self.autoFocusFocusableElementsCheckBox.SetValue(self.autoFocusFocusableElementsCheckBox.defaultValue) @@ -2234,7 +2234,7 @@ def onSave(self): config.conf['UIA']['winConsoleImplementation'] = ( self.consoleVals[consoleChoice] ) - config.conf["terminals"]["speakPasswords"]=self.speakPasswordsCheckBox.IsChecked() + config.conf["terminals"]["speakPasswords"] = self.speakPasswordsCheckBox.IsChecked() config.conf["terminals"]["keyboardSupportInLegacy"]=self.keyboardSupportInLegacyCheckBox.IsChecked() config.conf["virtualBuffers"]["autoFocusFocusableElements"] = self.autoFocusFocusableElementsCheckBox.IsChecked() config.conf["editableText"]["caretMoveTimeoutMs"]=self.caretMoveTimeoutSpinControl.GetValue() From 34faf5f76b8d5505573dfbb06d192131b645fa61 Mon Sep 17 00:00:00 2001 From: Bill Dengler Date: Fri, 2 Aug 2019 05:08:02 -0400 Subject: [PATCH 14/14] Lint. --- source/NVDAObjects/UIA/__init__.py | 1 + source/gui/settingsDialogs.py | 4 +++- 2 files changed, 4 insertions(+), 1 deletion(-) diff --git a/source/NVDAObjects/UIA/__init__.py b/source/NVDAObjects/UIA/__init__.py index d5537980bac..59ab1220044 100644 --- a/source/NVDAObjects/UIA/__init__.py +++ b/source/NVDAObjects/UIA/__init__.py @@ -26,6 +26,7 @@ import textInfos from logHandler import log from UIAUtils import * +from UIAUtils import shouldUseUIAConsole from NVDAObjects.window import Window from NVDAObjects import NVDAObjectTextInfo, InvalidNVDAObject from NVDAObjects.behaviors import ProgressBar, EditableTextWithoutAutoSelectDetection, Dialog, Notification, EditableTextWithSuggestions, ToolTip diff --git a/source/gui/settingsDialogs.py b/source/gui/settingsDialogs.py index fcc41b784ae..9b74ab524b5 100644 --- a/source/gui/settingsDialogs.py +++ b/source/gui/settingsDialogs.py @@ -1,7 +1,9 @@ # -*- coding: UTF-8 -*- # settingsDialogs.py # A part of NonVisual Desktop Access (NVDA) -# Copyright (C) 2006-2019 NV Access Limited, Peter Vágner, Aleksey Sadovoy, Rui Batista, Joseph Lee, Heiko Folkerts, Zahari Yurukov, Leonard de Ruijter, Derek Riemer, Babbage B.V., Davy Kager, Ethan Holliger, Bill Dengler +# Copyright (C) 2006-2019 NV Access Limited, Peter Vágner, Aleksey Sadovoy, +# Rui Batista, Joseph Lee, Heiko Folkerts, Zahari Yurukov, Leonard de Ruijter, +# Derek Riemer, Babbage B.V., Davy Kager, Ethan Holliger, Bill Dengler # This file is covered by the GNU General Public License. # See the file COPYING for more details.