Skip to content

Commit

Permalink
UI Automation in Windows Console: expose all three config options in …
Browse files Browse the repository at this point in the history
…preparation for usage by default (#13807)

Summary of the issue:
It was requested in #10964 (comment) that the ternary option be exposed separately to the change in default behaviour to ease revertability.

Description of how this pull request fixes the issue:
Exposes the ternary option as requested and updates the user guide.
  • Loading branch information
codeofdusk authored Jun 21, 2022
1 parent 0976a98 commit ccb2400
Show file tree
Hide file tree
Showing 2 changed files with 57 additions and 17 deletions.
57 changes: 42 additions & 15 deletions source/gui/settingsDialogs.py
Original file line number Diff line number Diff line change
Expand Up @@ -2680,15 +2680,42 @@ def __init__(self, parent):
self.bindHelpEvent("UseUiaForExcel", self.UIAInMSExcelCheckBox)
self.UIAInMSExcelCheckBox.SetValue(config.conf["UIA"]["useInMSExcelWhenAvailable"])
self.UIAInMSExcelCheckBox.defaultValue = self._getDefaultValue(["UIA", "useInMSExcelWhenAvailable"])

# Translators: This is the label for a checkbox in the
# Advanced settings panel.
label = _("Use UI Automation to access the Windows C&onsole when available")
consoleUIADevMap = True if config.conf['UIA']['winConsoleImplementation'] == 'UIA' else False
self.ConsoleUIACheckBox = UIAGroup.addItem(wx.CheckBox(UIABox, label=label))
self.bindHelpEvent("AdvancedSettingsConsoleUIA", self.ConsoleUIACheckBox)
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, UIA when available, and legacy.
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
# automatically.
# This option is currently equivalent to "legacy", but in a future
# version of NVDA, UIA will be used in known good implementations
# when this option is selected.
_("Automatic (legacy)"),
# Translators: A choice in a combo box in the advanced settings
# panel to have NVDA use UIA in the Windows Console when available.
_("UIA when available"),
# Translators: A choice in a combo box in the advanced settings
# panel to have NVDA use its legacy Windows Console support
# in all cases.
_("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)
self.bindHelpEvent("AdvancedSettingsConsoleUIA", self.consoleCombo)
curChoice = self.consoleVals.index(
config.conf['UIA']['winConsoleImplementation']
)
self.consoleCombo.SetSelection(curChoice)
self.consoleCombo.defaultValue = self.consoleVals.index(
self._getDefaultValue(["UIA", "winConsoleImplementation"])
)

label = pgettext(
"advanced.uiaWithChromium",
Expand Down Expand Up @@ -2980,7 +3007,7 @@ def haveConfigDefaultsBeenRestored(self):
)
and self.UIAInMSWordCombo.GetSelection() == self.UIAInMSWordCombo.defaultValue
and self.UIAInMSExcelCheckBox.IsChecked() == self.UIAInMSExcelCheckBox.defaultValue
and self.ConsoleUIACheckBox.IsChecked() == (self.ConsoleUIACheckBox.defaultValue == 'UIA')
and self.consoleCombo.GetSelection() == self.consoleCombo.defaultValue
and self.cancelExpiredFocusSpeechCombo.GetSelection() == self.cancelExpiredFocusSpeechCombo.defaultValue
and self.UIAInChromiumCombo.GetSelection() == self.UIAInChromiumCombo.defaultValue
and self.winConsoleSpeakPasswordsCheckBox.IsChecked() == self.winConsoleSpeakPasswordsCheckBox.defaultValue
Expand All @@ -3000,7 +3027,7 @@ def restoreToDefaults(self):
self.selectiveUIAEventRegistrationCheckBox.SetValue(self.selectiveUIAEventRegistrationCheckBox.defaultValue)
self.UIAInMSWordCombo.SetSelection(self.UIAInMSWordCombo.defaultValue)
self.UIAInMSExcelCheckBox.SetValue(self.UIAInMSExcelCheckBox.defaultValue)
self.ConsoleUIACheckBox.SetValue(self.ConsoleUIACheckBox.defaultValue == 'UIA')
self.consoleCombo.SetSelection(self.consoleCombo.defaultValue == 'auto')
self.UIAInChromiumCombo.SetSelection(self.UIAInChromiumCombo.defaultValue)
self.cancelExpiredFocusSpeechCombo.SetSelection(self.cancelExpiredFocusSpeechCombo.defaultValue)
self.winConsoleSpeakPasswordsCheckBox.SetValue(self.winConsoleSpeakPasswordsCheckBox.defaultValue)
Expand All @@ -3020,10 +3047,10 @@ def onSave(self):
config.conf["UIA"]["selectiveEventRegistration"] = self.selectiveUIAEventRegistrationCheckBox.IsChecked()
config.conf["UIA"]["allowInMSWord"] = self.UIAInMSWordCombo.GetSelection()
config.conf["UIA"]["useInMSExcelWhenAvailable"] = self.UIAInMSExcelCheckBox.IsChecked()
if self.ConsoleUIACheckBox.IsChecked():
config.conf['UIA']['winConsoleImplementation'] = "UIA"
else:
config.conf['UIA']['winConsoleImplementation'] = "auto"
consoleChoice = self.consoleCombo.GetSelection()
config.conf['UIA']['winConsoleImplementation'] = (
self.consoleVals[consoleChoice]
)
config.conf["featureFlag"]["cancelExpiredFocusSpeech"] = self.cancelExpiredFocusSpeechCombo.GetSelection()
config.conf["UIA"]["allowInChromium"] = self.UIAInChromiumCombo.GetSelection()
config.conf["terminals"]["speakPasswords"] = self.winConsoleSpeakPasswordsCheckBox.IsChecked()
Expand Down
17 changes: 15 additions & 2 deletions user_docs/en/userGuide.t2t
Original file line number Diff line number Diff line change
Expand Up @@ -1888,8 +1888,21 @@ This setting contains the following values:
- Always: where ever UI automation is available in Microsoft word (no matter how complete).
-

==== 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.
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: This option is currently equivalent to "legacy".
However, with this option selected, NVDA will begin using UI Automation in consoles automatically in a future version once it has become stable and suitable for wider use.
- UIA when available: Uses UI Automation in consoles if available.
This will include Console versions which have incomplete or buggy UI Automation implementations.
Though not yet fully stable, UI Automation may provide a superior user experience in some scenarios, especially in the Windows 11 Sun Valley 2 (22H2) update.
- Legacy: UI Automation in the Windows Console will be completely disabled.
The legacy fallback will always be used even in situations where UI Automation would provide a superior user experience.
Therefore, selecting this option is not recommended unless you know what you are doing.
-

==== Use UIA with Microsoft Edge and other Chromium based browsers when available ====[ChromiumUIA]
Allows specifying when UIA will be used when it is available in Chromium based browsers such as Microsoft Edge.
Expand Down

0 comments on commit ccb2400

Please sign in to comment.