Permalink
Browse files

Windows 10/Action Center: announce item status messages for brightnes…

…s, focus assist and others, as well as reclassify brightness control as a button (#8954)

* UIA handler: add item status property change event. Re #8845.

Some controls raise UIA item status property change event, allowing clients to announce status changes. This is most noticeable in Windows 10's Action Center where one can change brightness and Focus Assist (quiet hours) where toggling these controls will cause them to raise this event.

* App modules/Shell Experience Host: copyright header edits, add top-level docstring.

* Shell Experience Host: announce status changes for various Action Center controls. Re #8845.

Thanks to UIA's item status property change event, status for the following will be announced when toggling them:
* Brightness
* Focus Assist/quiet hours

Because item status property change is raised multiple times (or rather, NVDA announces status messages multiple times), have a string to hold last announced status.

* Shell Experience Host: Brightness button is now a plain button, not a toggle button. Re #8845.

Brightness button is now a plain button, not a toggle button. Note that this control is now a slider in Windows 10 19H1 build 18277 and later.

* Shell Experience Host/item status: clarify comment.

* UIA item status: address review comments. Re #8845.

Comment: make it more professional.
_itemStatusMessage -> _itemStatusMessageCache for readability.

* Update copyright years

* Action Center/toggle button: address review comments. Re #8845.

Reviewed by Mick Curran (NV Access): tweaks and changes:
* An overlay class will be used to handle toggle button value change state.
* Current item status cache will now be part of the new toggle button overlay class.

* Action Center toggle button object: address review comment - assign cache no matter what the new value is. Re #8845.

* Update what's new.
  • Loading branch information...
josephsl authored and michaelDCurran committed Jan 10, 2019
1 parent 1d5b38e commit aee76d10a50aaa275c7e1313eec3d409fc793ef3
Showing with 41 additions and 2 deletions.
  1. +2 −1 source/_UIAHandler.py
  2. +37 −1 source/appModules/shellexperiencehost.py
  3. +2 −0 user_docs/en/changes.t2t
@@ -1,6 +1,6 @@
#_UIAHandler.py
#A part of NonVisual Desktop Access (NVDA)
#Copyright (C) 2011-2018 NV Access Limited, Joseph Lee, Babbage B.V.
#Copyright (C) 2011-2019 NV Access Limited, Joseph Lee, Babbage B.V.
#This file is covered by the GNU General Public License.
#See the file COPYING for more details.

@@ -134,6 +134,7 @@
UIA_ValueValuePropertyId:"valueChange",
UIA_RangeValueValuePropertyId:"valueChange",
UIA_ControllerForPropertyId:"UIA_controllerFor",
UIA_ItemStatusPropertyId:"UIA_itemStatus",
}

UIAEventIdsToNVDAEventNames={
@@ -1,13 +1,47 @@
#A part of NonVisual Desktop Access (NVDA)
#Copyright (C) 2015 NV Access Limited
#Copyright (C) 2015-2019 NV Access Limited, Joseph Lee
#This file is covered by the GNU General Public License.
#See the file COPYING for more details.

"""App module for Shell Experience Host, part of Windows 10.
Shell Experience Host is home to a number of things, including Action Center and other shell features.
"""

import appModuleHandler
from NVDAObjects.IAccessible import IAccessible, ContentGenericClient
from NVDAObjects.UIA import UIA
import controlTypes
import ui

class ActionCenterToggleButton(UIA):

# Somehow, item status property repeats when Action Center is opened more than once.
_itemStatusMessageCache = None

def _get_value(self):
return self.UIAElement.currentItemStatus

def event_UIA_itemStatus(self):
self.event_valueChange()

def event_valueChange(self):
# Do not repeat item status multiple times.
currentItemStatus = self.value
if currentItemStatus and currentItemStatus != self._itemStatusMessageCache:
ui.message(currentItemStatus)
self._itemStatusMessageCache = currentItemStatus


class AppModule(appModuleHandler.AppModule):

def event_NVDAObject_init(self, obj):
if isinstance(obj, UIA):
# #8845: Brightness button in Action Center is a button, not a toggle button.
# Brightness control is now a slider in build 18277.
if obj.UIAElement.cachedAutomationID == "Microsoft.QuickAction.Brightness":
obj.role = controlTypes.ROLE_BUTTON
obj.states.discard(controlTypes.STATE_CHECKABLE)

def chooseNVDAObjectOverlayClasses(self,obj,clsList):
if isinstance(obj, IAccessible):
try:
@@ -16,3 +50,5 @@ def chooseNVDAObjectOverlayClasses(self,obj,clsList):
clsList.remove(ContentGenericClient)
except ValueError:
pass
elif isinstance(obj, UIA) and obj.role == controlTypes.ROLE_TOGGLEBUTTON and obj.UIAElement.cachedClassName == "ToggleButton":
clsList.insert(0, ActionCenterToggleButton)
@@ -31,6 +31,8 @@ What's New in NVDA
- Removed the "Welcome Dialog" entry in the NVDA menu while on secure screens. (#8520)
- When tabbing or using quick navigation in browse mode, legends on tab panels are now reported more consistently. (#709)
- NVDA will now announce selection changes for certain time pickers such as in the Alarms and Clock app. (#5231)
- In Windows 10's Action Center, NVDA will announce status messages when toggling quick actions such as brightness and focus assist. (#8954)
- In action Center in Windows 10 October 2018 Update and earlier, NVDA will recognize brightness quick action control as a button instead of a toggle button. (#8845)


== Changes for Developers ==

0 comments on commit aee76d1

Please sign in to comment.