| Trees | Indices | Help |
|---|
|
|
1 #appModules/explorer.py 2 #A part of NonVisual Desktop Access (NVDA) 3 #Copyright (C) 2006-2010 NVDA Contributors <http://www.nvda-project.org/> 4 #This file is covered by the GNU General Public License. 5 #See the file COPYING for more details. 6 7 import time 8 import appModuleHandler 9 import controlTypes 10 import winUser 11 import speech 12 import eventHandler 13 import mouseHandler 14 from NVDAObjects.window import Window 15 from NVDAObjects.IAccessible import sysListView32, IAccessible 16 17 #win8hack: Class to disable incorrect focus on windows 8 search box (containing the already correctly focused edit field)19 shouldAllowIAccessibleFocusEvent=False20 21 22 #Class for menu items for Windows Places and Frequently used Programs (in start menu)24 25 #When focus moves to these items, an extra focus is fired on the parent 26 #However NVDA redirects it to the real focus. 27 #But this means double focus events on the item, so filter the second one out 28 #Ticket #4743730 res=super(SysListView32MenuItem,self).shouldAllowIAccessibleFocusEvent 31 if not res: 32 return False 33 focus=eventHandler.lastQueuedFocusObject 34 if type(focus)!=type(self) or (self.event_windowHandle,self.event_objectID,self.event_childID)!=(focus.event_windowHandle,focus.event_objectID,focus.event_childID): 35 return True 36 return False39 # Override the name, as Windows names this the "Application" menu contrary to all documentation. 40 name = _("Start") 414643 # In Windows XP, the Start button will get focus first, so silence this. 44 speech.cancelSpeech() 45 super(ClassicStartMenu, self).event_gainFocus()48 """The Windows notification area, a.k.a. system tray. 49 """ 507752 if mouseHandler.lastMouseEventTime < time.time() - 0.2: 53 # This focus change was not caused by a mouse event. 54 # If the mouse is on another toolbar control, the notification area toolbar will rudely 55 # bounce the focus back to the object under the mouse after a brief pause. 56 # Moving the mouse to the focus object isn't a good solution because 57 # sometimes, the focus can't be moved away from the object under the mouse. 58 # Therefore, move the mouse out of the way. 59 winUser.setCursorPos(0, 0) 60 61 if self.role == controlTypes.ROLE_TOOLBAR: 62 # Sometimes, the toolbar itself receives the focus instead of the focused child. 63 # However, the focused child still has the focused state. 64 for child in self.children: 65 if child.hasFocus: 66 # Redirect the focus to the focused child. 67 eventHandler.executeEvent("gainFocus", child) 68 return 69 # We've really landed on the toolbar itself. 70 # This was probably caused by moving the mouse out of the way in a previous focus event. 71 # This previous focus event is no longer useful, so cancel speech. 72 speech.cancelSpeech() 73 74 if eventHandler.isPendingEvents("gainFocus"): 75 return 76 super(NotificationArea, self).event_gainFocus()7915481 windowClass = obj.windowClassName 82 role = obj.role 83 84 if windowClass in ("Search Box","UniversalSearchBand") and role==controlTypes.ROLE_PANE and isinstance(obj,IAccessible): 85 clsList.insert(0,SearchBoxClient) 86 return 87 88 if windowClass == "ToolbarWindow32" and role == controlTypes.ROLE_POPUPMENU: 89 parent = obj.parent 90 if parent and parent.windowClassName == "SysPager" and obj.windowStyle & 0x80: 91 clsList.insert(0, ClassicStartMenu) 92 return 93 94 if windowClass == "SysListView32" and role == controlTypes.ROLE_MENUITEM: 95 clsList.insert(0, SysListView32MenuItem) 96 return 97 98 if windowClass == "ToolbarWindow32": 99 # Check whether this is the notification area, a.k.a. system tray. 100 if isinstance(obj.parent, ClassicStartMenu): 101 return #This can't be a notification area 102 try: 103 # The toolbar's immediate parent is its window object, so we need to go one further. 104 toolbarParent = obj.parent.parent 105 if role != controlTypes.ROLE_TOOLBAR: 106 # Toolbar item. 107 toolbarParent = toolbarParent.parent 108 except AttributeError: 109 toolbarParent = None 110 if toolbarParent and toolbarParent.windowClassName == "SysPager": 111 clsList.insert(0, NotificationArea) 112 return113115 windowClass = obj.windowClassName 116 role = obj.role 117 118 if windowClass == "ToolbarWindow32" and role == controlTypes.ROLE_POPUPMENU: 119 parent = obj.parent 120 if parent and parent.windowClassName == "SysPager" and not (obj.windowStyle & 0x80): 121 # This is the menu for a group of icons on the task bar, which Windows stupidly names "Application". 122 obj.name = None 123 return 124 125 if windowClass == "#32768": 126 # Standard menu. 127 parent = obj.parent 128 if parent and not parent.parent: 129 # Context menu. 130 # We don't trust the names that Explorer gives to context menus, so better to have no name at all. 131 obj.name = None 132 return 133 134 if windowClass == "DV2ControlHost" and role == controlTypes.ROLE_PANE: 135 # Windows Vista/7 start menu. 136 obj.presentationType=obj.presType_content 137 obj.isPresentableFocusAncestor = True 138 # In Windows 7, the description of this pane is extremely verbose help text, so nuke it. 139 obj.description = None 140 return 141 142 #The Address bar is embedded inside a progressbar, how strange. 143 #Lets hide that 144 if windowClass=="msctls_progress32" and winUser.getClassName(winUser.getAncestor(obj.windowHandle,winUser.GA_PARENT))=="Address Band Root": 145 obj.presentationType=obj.presType_layout146148 if obj.windowClassName == "ToolbarWindow32" and obj.role == controlTypes.ROLE_MENUITEM and obj.parent.role == controlTypes.ROLE_MENUBAR and eventHandler.isPendingEvents("gainFocus"): 149 # When exiting a menu, Explorer fires focus on the top level menu item before it returns to the previous focus. 150 # Unfortunately, this focus event always occurs in a subsequent cycle, so the event limiter doesn't eliminate it. 151 # Therefore, if there is a pending focus event, don't bother handling this event. 152 return 153 nextHandler()
| Trees | Indices | Help |
|---|
| Generated by Epydoc 3.0.1 on Fri Nov 18 17:46:03 2011 | http://epydoc.sourceforge.net |