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
11
from NVDAObjects.IAccessible import IAccessible
7
12
from NVDAObjects.behaviors import Dialog
13
import appModuleHandler
16
"""App module for the Windows Logon screen
11
19
class LogonDialog(Dialog):
13
21
role = controlTypes.ROLE_DIALOG
27
35
class XPPasswordField(IAccessible):
29
37
def initOverlayClass(self):
31
("extendedUp", "changeUser"),
32
("extendedDown", "changeUser"),
34
self.bindKey_runtime(key, script)
38
for gesture in ("kb:upArrow", "kb:downArrow"):
39
self.bindGesture(gesture, "changeUser")
36
41
def _get_name(self):
37
42
# Focus automatically jumps to the password field when a user is selected. This field has no name.
38
43
# This means that the new selected user is not reported.
39
# Therefore, override the name of the password field to be the selected user name.
40
# When the user is changed, the parent list item changes.
41
# However, the cached parent isn't updated, so force it to update.
42
self.parent = self._get_parent()
44
# However, the selected user name is the name of the window object for this field.
46
self.parent.invalidateCache()
44
47
return self.parent.name
46
49
return super(XPPasswordField, self).name
48
def script_changeUser(self, key):
51
def script_changeUser(self, gesture):
49
52
# The up and down arrow keys change the selected user, but there's no reliable NVDA event for detecting this.
50
53
oldName = self.name
55
self.invalidateCache()
52
56
if oldName == self.name or controlTypes.STATE_FOCUSED not in self.states:
54
58
self.event_gainFocus()
56
class AppModule(_default.AppModule):
60
class AppModule(appModuleHandler.AppModule):
58
62
def event_NVDAObject_init(self, obj):
59
63
if obj.windowClassName == "NativeHWNDHost" and obj.parent and not obj.parent.parent:
64
68
def chooseNVDAObjectOverlayClasses(self, obj, clsList):
65
69
windowClass = obj.windowClassName
67
if windowClass == "AUTHUI.DLL: LogonUI Logon Window" and obj.parent and not obj.parent.parent:
71
if windowClass == "AUTHUI.DLL: LogonUI Logon Window" and obj.parent and obj.parent.parent and not obj.parent.parent.parent:
68
72
clsList.insert(0, LogonDialog)
71
75
if windowClass == "Edit" and not obj.name:
72
76
parent = obj.parent
73
if parent and parent.role == controlTypes.ROLE_LISTITEM:
77
if parent and parent.role == controlTypes.ROLE_WINDOW:
74
78
clsList.insert(0, XPPasswordField)