~stomato463/+junk/nvdajp

« back to all changes in this revision

Viewing changes to source/appModules/logonui.py

  • Committer: Masataka Shinke
  • Date: 2011-10-25 12:35:26 UTC
  • mfrom: (4185 jpmain)
  • mto: This revision was merged to the branch mainline in revision 4211.
  • Revision ID: mshinke@users.sourceforge.jp-20111025123526-ze527a2rl3z0g2ky
lp:~nishimotz/nvdajp/main : 4185 をマージ

Show diffs side-by-side

added added

removed removed

Lines of Context:
1
 
import keyUtils
 
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
 
2
7
import speech
3
8
import api
4
9
import braille
5
10
import controlTypes
6
11
from NVDAObjects.IAccessible import IAccessible
7
12
from NVDAObjects.behaviors import Dialog
8
 
import _default
 
13
import appModuleHandler
9
14
import eventHandler
10
15
 
 
16
"""App module for the Windows Logon screen
 
17
"""
 
18
 
11
19
class LogonDialog(Dialog):
12
20
 
13
21
        role = controlTypes.ROLE_DIALOG
27
35
class XPPasswordField(IAccessible):
28
36
 
29
37
        def initOverlayClass(self):
30
 
                for key, script in (
31
 
                        ("extendedUp", "changeUser"),
32
 
                        ("extendedDown", "changeUser"),
33
 
                ):
34
 
                        self.bindKey_runtime(key, script)
 
38
                for gesture in ("kb:upArrow", "kb:downArrow"):
 
39
                        self.bindGesture(gesture, "changeUser")
35
40
 
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.
43
45
                try:
 
46
                        self.parent.invalidateCache()
44
47
                        return self.parent.name
45
48
                except:
46
49
                        return super(XPPasswordField, self).name
47
50
 
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
51
 
                keyUtils.sendKey(key)
 
54
                gesture.send()
 
55
                self.invalidateCache()
52
56
                if oldName == self.name or controlTypes.STATE_FOCUSED not in self.states:
53
57
                        return
54
58
                self.event_gainFocus()
55
59
 
56
 
class AppModule(_default.AppModule):
 
60
class AppModule(appModuleHandler.AppModule):
57
61
 
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
66
70
 
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)
69
73
                        return
70
74
 
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)
75
79
                                return
76
80