Skip to content

Commit 03b7cdf

Browse files
authored
Merge eb4fc3a into 1392aa3
2 parents 1392aa3 + eb4fc3a commit 03b7cdf

File tree

4 files changed

+95
-12
lines changed

4 files changed

+95
-12
lines changed

source/NVDAObjects/UIA/__init__.py

+12-3
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
# A part of NonVisual Desktop Access (NVDA)
22
# This file is covered by the GNU General Public License.
33
# See the file COPYING for more details.
4-
# Copyright (C) 2009-2020 NV Access Limited, Joseph Lee, Mohammad Suliman,
4+
# Copyright (C) 2009-2021 NV Access Limited, Joseph Lee, Mohammad Suliman,
55
# Babbage B.V., Leonard de Ruijter, Bill Dengler
66

77
"""Support for UI Automation (UIA) controls."""
@@ -1722,12 +1722,21 @@ def event_UIA_systemAlert(self):
17221722
def event_UIA_notification(self, notificationKind=None, notificationProcessing=UIAHandler.NotificationProcessing_CurrentThenMostRecent, displayString=None, activityId=None):
17231723
"""
17241724
Introduced in Windows 10 Fall Creators Update (build 16299).
1725-
This base implementation announces all notifications from the UIA element.
1725+
This base implementation announces all notifications from the UIA element if enabled from NVDA.
17261726
Unlike other events, the text to be announced is not the name of the object, and parameters control how the incoming notification should be processed.
17271727
Subclasses can override this event and can react to notification processing instructions.
17281728
"""
17291729
# Do not announce notifications from background apps.
1730-
if self.appModule != api.getFocusObject().appModule:
1730+
# #10956: ignore this altogether if NVDA should not handle this event
1731+
# either always or from background apps.
1732+
appNotificationsFromAllApps = config.conf['presentation']["appNotificationsFromAllApps"]
1733+
if (
1734+
not config.conf['presentation']['reportAppNotifications']
1735+
or (
1736+
appNotificationsFromAllApps == "focusedApp"
1737+
and self.appModule != api.getFocusObject().appModule
1738+
)
1739+
):
17311740
return
17321741
if displayString:
17331742
if notificationProcessing in (UIAHandler.NotificationProcessing_ImportantMostRecent, UIAHandler.NotificationProcessing_MostRecent):

source/config/configSpec.py

+2
Original file line numberDiff line numberDiff line change
@@ -87,6 +87,8 @@
8787
guessObjectPositionInformationWhenUnavailable = boolean(default=false)
8888
reportTooltips = boolean(default=false)
8989
reportHelpBalloons = boolean(default=true)
90+
reportAppNotifications = boolean(default=true)
91+
appNotificationsFromAllApps = option("always", "focusedApp", default="focusedApp")
9092
reportObjectDescriptions = boolean(default=True)
9193
reportDynamicContentChanges = boolean(default=True)
9294
reportAutoSuggestionsWithSound = boolean(default=True)

source/gui/settingsDialogs.py

+61-6
Original file line numberDiff line numberDiff line change
@@ -1882,6 +1882,14 @@ class ObjectPresentationPanel(SettingsPanel):
18821882
# See Progress bar output in the Object Presentation Settings section of the User Guide.
18831883
("both", _("Speak and beep")),
18841884
)
1885+
appNotificationLabels = (
1886+
# Translators: one of the app notification choices
1887+
# to always announce notifications.
1888+
("always", pgettext("app notification", "all apps")),
1889+
# Translators: one of the app notification choices
1890+
# to announce notifications from focused app.
1891+
("focusedApp", pgettext("app notification", "foreground app")),
1892+
)
18851893

18861894
def makeSettings(self, settingsSizer):
18871895
sHelper = guiHelper.BoxSizerHelper(self, sizer=settingsSizer)
@@ -1892,12 +1900,47 @@ def makeSettings(self, settingsSizer):
18921900
self.bindHelpEvent("ObjectPresentationReportToolTips", self.tooltipCheckBox)
18931901
self.tooltipCheckBox.SetValue(config.conf["presentation"]["reportTooltips"])
18941902

1895-
# Translators: This is the label for a checkbox in the
1903+
# Translators: This is the label for a checkable list in the
18961904
# object presentation settings panel.
1897-
balloonText = _("Report &notifications")
1898-
self.balloonCheckBox=sHelper.addItem(wx.CheckBox(self,label=balloonText))
1899-
self.bindHelpEvent("ObjectPresentationReportNotifications", self.balloonCheckBox)
1900-
self.balloonCheckBox.SetValue(config.conf["presentation"]["reportHelpBalloons"])
1905+
notificationsText = _("Report &notifications")
1906+
self.reportNotificationChoices = [
1907+
# Translators: This is the label for a notification setting in
1908+
# report notifications list.
1909+
_("help balloons and toasts"),
1910+
# Translators: This is the label for a notification setting in
1911+
# report notifications list.
1912+
_("app notifications")
1913+
]
1914+
self.notificationsList = sHelper.addLabeledControl(
1915+
notificationsText,
1916+
nvdaControls.CustomCheckListBox,
1917+
choices=self.reportNotificationChoices
1918+
)
1919+
notificationSettings = ("reportHelpBalloons", "reportAppNotifications")
1920+
self.notificationsList.CheckedItems = [
1921+
notificationSettings.index(setting) for setting in notificationSettings
1922+
if config.conf["presentation"][setting]
1923+
]
1924+
# Enable/disable app notification list if app notifications checkbox is checked/unchecked.
1925+
self.Bind(wx.EVT_CHECKLISTBOX, self.onNotificationToggle)
1926+
self.bindHelpEvent("ObjectPresentationReportNotifications", self.notificationsList)
1927+
self.notificationsList.Select(0)
1928+
1929+
# Translators: This is the label for a combo box in the
1930+
# object presentation settings panel.
1931+
appNotificationText = _("Report &app notifications:")
1932+
notificationChoices = [label for setting, label in self.appNotificationLabels]
1933+
self.appNotificationList = sHelper.addLabeledControl(
1934+
appNotificationText, wx.Choice, choices=notificationChoices
1935+
)
1936+
self.bindHelpEvent("ObjectPresentationAppNotifications", self.appNotificationList)
1937+
notificationSettings = [setting for setting, label in self.appNotificationLabels]
1938+
try:
1939+
selection = notificationSettings.index(config.conf["presentation"]["appNotificationsFromAllApps"])
1940+
except ValueError:
1941+
selection = 0
1942+
self.appNotificationList.SetSelection(selection)
1943+
self.appNotificationList.Enable(config.conf["presentation"]["reportAppNotifications"])
19011944

19021945
# Translators: This is the label for a checkbox in the
19031946
# object presentation settings panel.
@@ -1970,9 +2013,21 @@ def makeSettings(self, settingsSizer):
19702013
)
19712014
self.autoSuggestionSoundsCheckBox.SetValue(config.conf["presentation"]["reportAutoSuggestionsWithSound"])
19722015

2016+
def onNotificationToggle(self, evt):
2017+
appNotifications = 1
2018+
self.appNotificationList.Enable(
2019+
self.notificationsList.IsChecked(appNotifications)
2020+
)
2021+
19732022
def onSave(self):
19742023
config.conf["presentation"]["reportTooltips"]=self.tooltipCheckBox.IsChecked()
1975-
config.conf["presentation"]["reportHelpBalloons"]=self.balloonCheckBox.IsChecked()
2024+
helpBalloonNotifications = 0
2025+
config.conf["presentation"]["reportHelpBalloons"] = self.notificationsList.IsChecked(helpBalloonNotifications)
2026+
appNotifications = 1
2027+
config.conf["presentation"]["reportAppNotifications"] = self.notificationsList.IsChecked(appNotifications)
2028+
config.conf["presentation"]["appNotificationsFromAllApps"] = (
2029+
self.appNotificationLabels[self.appNotificationList.GetSelection()][0]
2030+
)
19762031
config.conf["presentation"]["reportKeyboardShortcuts"]=self.shortcutCheckBox.IsChecked()
19772032
config.conf["presentation"]["reportObjectPositionInformation"]=self.positionInfoCheckBox.IsChecked()
19782033
config.conf["presentation"]["guessObjectPositionInformationWhenUnavailable"]=self.guessPositionInfoCheckBox.IsChecked()

user_docs/en/userGuide.t2t

+20-3
Original file line numberDiff line numberDiff line change
@@ -1579,9 +1579,26 @@ A checkbox that when checked tells NVDA to report tooltips as they appear.
15791579
Many Windows and controls show a small message (or tooltip) when you move the mouse pointer over them, or sometimes when you move the focus to them.
15801580

15811581
==== Report notifications ====[ObjectPresentationReportNotifications]
1582-
This checkbox, when checked, tells NVDA to report help balloons and toast notifications as they appear.
1583-
- Help Balloons are like tooltips, but are usually larger in size, and are associated with system events such as a network cable being unplugged, or perhaps to alert you about Windows security issues.
1584-
- Toast notifications have been introduced in Windows 10 and appear in the notification centre in the system tray, informing about several events (i.e. if an update has been downloaded, a new e-mail arrived in your inbox, etc.).
1582+
Checkboxes in this setting allows you to configure which notifications will be announced.
1583+
Notifications can include:
1584+
- Help balloons and toasts:
1585+
- Help Balloons are like tooltips, but are usually larger in size, and are associated with system events such as a network cable being unplugged, or perhaps to alert you about Windows security issues.
1586+
- Toast notifications were introduced in Windows 8 and appear in the notification centre in the system tray, informing about several events (i.e. if an update has been downloaded, a new e-mail arrived in your inbox, etc.).
1587+
- Apps: notifications from apps such as page load status in web browsers.
1588+
- In Windows 10 Fall creators update (version 1709) or later, app notifications can include UIA accessible event notifications from apps such as Microsoft Edge, microsoft Store, and audio volume changes.
1589+
-
1590+
-
1591+
1592+
==== Report app notifications ====[ObjectPresentationAppNotifications]
1593+
If app notifications is enabled in [report notifications #ObjectPresentationReportNotifications], this combo box sets which app notifications should be announced.
1594+
1595+
A special type of app notifications is UIA accessible event notifications, introduced in Windows 10 Fall Creators Update.
1596+
Accessible event notifications are used by apps to let assistive technologies such as NVDA announce important information.
1597+
These announcements include update check results from Microsoft Store, page load status in Microsoft Edge, and audio volume changes while focused on File Explorer.
1598+
1599+
The available options are:
1600+
- All apps: announce notifications from all apps, including background notifications.
1601+
- Foreground app: announce notifications from the app you are using.
15851602
-
15861603

15871604
==== Report Object Shortcut Keys ====[ObjectPresentationShortcutKeys]

0 commit comments

Comments
 (0)