Package appModules :: Module logonui
[hide private]
[frames] | no frames]

Source Code for Module appModules.logonui

 1  #appModules/logonui.py 
 2  #A part of NonVisual Desktop Access (NVDA) 
 3  #This file is covered by the GNU General Public License. 
 4  #See the file COPYING for more details. 
 5  #Copyright (C) 2009-2011 James Teh <jamie@jantrid.net>, Michael Curran <mick@kulgan.net> 
 6   
 7  import speech 
 8  import api 
 9  import braille 
10  import controlTypes 
11  from NVDAObjects.IAccessible import IAccessible 
12  from NVDAObjects.behaviors import Dialog 
13  import appModuleHandler 
14  import eventHandler 
15   
16  """App module for the Windows Logon screen 
17  """ 
18   
19 -class LogonDialog(Dialog):
20 21 role = controlTypes.ROLE_DIALOG 22 isPresentableFocusAncestor = True 23
24 - def event_gainFocus(self):
25 child = self.firstChild 26 if child and controlTypes.STATE_FOCUSED in child.states and not eventHandler.isPendingEvents("gainFocus"): 27 # UIA reports that focus is on the top level pane, even when it's actually on the frame below. 28 # This causes us to incorrectly use UIA for the top level pane, which causes this pane to be spoken again when the focus moves. 29 # Therefore, bounce the focus to the correct object. 30 eventHandler.queueEvent("gainFocus", child) 31 return 32 33 return super(LogonDialog, self).event_gainFocus()
34
35 -class XPPasswordField(IAccessible):
36
37 - def initOverlayClass(self):
38 for gesture in ("kb:upArrow", "kb:downArrow"): 39 self.bindGesture(gesture, "changeUser")
40
41 - def _get_name(self):
42 # Focus automatically jumps to the password field when a user is selected. This field has no name. 43 # This means that the new selected user is not reported. 44 # However, the selected user name is the name of the window object for this field. 45 try: 46 self.parent.invalidateCache() 47 return self.parent.name 48 except: 49 return super(XPPasswordField, self).name
50
51 - def script_changeUser(self, gesture):
52 # The up and down arrow keys change the selected user, but there's no reliable NVDA event for detecting this. 53 oldName = self.name 54 gesture.send() 55 self.invalidateCache() 56 if oldName == self.name or controlTypes.STATE_FOCUSED not in self.states: 57 return 58 self.event_gainFocus()
59
60 -class AppModule(appModuleHandler.AppModule):
61
62 - def event_NVDAObject_init(self, obj):
63 if obj.windowClassName == "NativeHWNDHost" and obj.parent and not obj.parent.parent: 64 # This is the top level pane of the XP logon screen. 65 # Make sure it is always presented. 66 obj.isPresentableFocusAncestor = True
67
68 - def chooseNVDAObjectOverlayClasses(self, obj, clsList):
69 windowClass = obj.windowClassName 70 71 if windowClass == "AUTHUI.DLL: LogonUI Logon Window" and obj.parent and obj.parent.parent and not obj.parent.parent.parent: 72 clsList.insert(0, LogonDialog) 73 return 74 75 if windowClass == "Edit" and not obj.name: 76 parent = obj.parent 77 if parent and parent.role == controlTypes.ROLE_WINDOW: 78 clsList.insert(0, XPPasswordField) 79 return
80
81 - def event_gainFocus(self,obj,nextHandler):
82 if obj.windowClassName=="DirectUIHWND" and obj.role==controlTypes.ROLE_BUTTON and not obj.next: 83 prev=obj.previous 84 if prev and prev.role==controlTypes.ROLE_STATICTEXT: 85 # This is for a popup message in the logon dialog. 86 # Present the dialog again so the message will be reported. 87 speech.speakObjectProperties(api.getForegroundObject(),name=True,role=True,description=True) 88 braille.invalidateCachedFocusAncestors(1) 89 nextHandler()
90