Skip to content

Commit

Permalink
Automatically announce notifications in IE 9 and above. Fixes #2343
Browse files Browse the repository at this point in the history
  • Loading branch information
michaelDCurran committed Nov 26, 2012
1 parent 3653802 commit 6d2b3a4
Show file tree
Hide file tree
Showing 3 changed files with 30 additions and 4 deletions.
4 changes: 2 additions & 2 deletions source/IAccessibleHandler.py
Expand Up @@ -730,8 +730,8 @@ def processForegroundWinEvent(window,objectID,childID):

def processShowWinEvent(window,objectID,childID):
className=winUser.getClassName(window)
#For now we only support 'show' event for tooltips as otherwize we get flooded
if className in ("tooltips_class32","mscandui21.candidate","mscandui40.candidate","MSCandUIWindow_Candidate") and objectID==winUser.OBJID_CLIENT:
#For now we only support 'show' event for tooltips, IMM candidates and notification bars as otherwize we get flooded
if className in ("Frame Notification Bar","tooltips_class32","mscandui21.candidate","mscandui40.candidate","MSCandUIWindow_Candidate") and objectID==winUser.OBJID_CLIENT:
NVDAEvent=winEventToNVDAEvent(winUser.EVENT_OBJECT_SHOW,window,objectID,childID)
if NVDAEvent:
eventHandler.queueEvent(*NVDAEvent)
Expand Down
29 changes: 27 additions & 2 deletions source/NVDAObjects/IAccessible/__init__.py
@@ -1,4 +1,3 @@
#NVDAObjects/IAccessible.py
#A part of NonVisual Desktop Access (NVDA)
#Copyright (C) 2006-2012 NVDA Contributors
#This file is covered by the GNU General Public License.
Expand Down Expand Up @@ -31,7 +30,6 @@
from NVDAObjects import NVDAObject, NVDAObjectTextInfo, InvalidNVDAObject
import NVDAObjects.JAB
import eventHandler
import queueHandler
from NVDAObjects.behaviors import ProgressBar, Dialog, EditableTextWithAutoSelectDetection, FocusableUnfocusableContainer

def getNVDAObjectFromEvent(hwnd,objectID,childID):
Expand Down Expand Up @@ -412,6 +410,12 @@ def findOverlayClasses(self,clsList):
clsList.append(newCls)

# Some special cases.
if windowClassName=="Frame Notification Bar" and role==oleacc.ROLE_SYSTEM_CLIENT:
clsList.append(IEFrameNotificationBar)
elif windowClassName=="DirectUIHWND" and role==oleacc.ROLE_SYSTEM_TOOLBAR:
parentWindow=winUser.getAncestor(self.windowHandle,winUser.GA_PARENT)
if parentWindow and winUser.getClassName(parentWindow)=="Frame Notification Bar":
clsList.append(IENotificationBar)
if windowClassName.lower().startswith('mscandui'):
import mscandui
mscandui.findExtraOverlayClasses(self,clsList)
Expand Down Expand Up @@ -1680,6 +1684,27 @@ class ListviewPane(IAccessible):
TextInfo=displayModel.DisplayModelTextInfo
name=""

class IEFrameNotificationBar(IAccessible):

def event_show(self):
child=self.simpleFirstChild
if isinstance(child,Dialog):
child.event_alert()

#The Internet Explorer notification toolbar should be handled as an alert
class IENotificationBar(Dialog,IAccessible):
name=""
role=controlTypes.ROLE_ALERT

def event_alert(self):
speech.cancelSpeech()
speech.speakObject(self,reason=controlTypes.REASON_FOCUS)
child=self.simpleFirstChild
while child:
if child.role!=controlTypes.ROLE_STATICTEXT:
speech.speakObject(child,reason=controlTypes.REASON_FOCUS)
child=child.simpleNext

###class mappings

_staticMap={
Expand Down
1 change: 1 addition & 0 deletions user_docs/en/changes.t2t
Expand Up @@ -8,6 +8,7 @@
== New Features ==
- Basic support for reading and writing messages in Lotus Notes 8.5. (#543)
- In Browse mode for MSHTML (e.g. Internet Explorer) and Gecko (e.g. Firefox), the existance of long descriptions are now announced. Its also possible to open the long description in a new window by pressing NVDA+d. (#809)
- Notifications in Internet Explorer 9 and above are now spoken (such as content blocking or file downloads). (#2343)


== Bug Fixes ==
Expand Down

0 comments on commit 6d2b3a4

Please sign in to comment.