1 '''
2 Defines a special L{AEScript <AEScript.AEScript>} for the gdm login screen.
3
4 @author: Peter Parente
5 @organization: IBM Corporation
6 @copyright: Copyright (c) 2005, 2007 IBM Corporation
7
8 @author: Nicole Anacker
9 @organization: IT Science Center Ruegen gGmbH, Germany
10 @copyright: Copyright (c) 2007, 2008 ITSC Ruegen
11
12 @license: I{The BSD License}.
13 All rights reserved. This program and the accompanying materials are made
14 available under the terms of the BSD license which accompanies
15 this distribution, and is available at
16 U{http://www.opensource.org/licenses/bsd-license.php}
17 '''
18
19 from AccessEngine import AEScript, AccessEngineAPI
20 from AccessEngine import AEConstants
21
22 from Tools.i18n import _
23
24
25
26
27 __uie__ = dict(kind='script', tier=None, all_tiers=True)
28
30 '''
31 A special L{AEScript <AEScript.AEScript>} for the gdm login screen.
32 Registers tasks to announce the focused control on startup, typically the
33 username field.
34
35 @ivar first: If C{True} then the text box requires the input of the username.
36 If C{False} then the text box requires the input of the password.
37 @type first: boolean
38
39 @todo: NA: test functions
40 '''
56
58 '''
59 Return the name of the supported application.
60
61 @return: Translated name of the supported application.
62 @rtype: string
63 '''
64 return _('GNOME login')
65
67 '''
68 Describe which L{AETier} this script applies to by default.
69
70 @return: Human readable translated description of this script.
71 @rtype: string
72 '''
73 return _('Corrects username/password accessibility problems at login. '
74 'Applies to gdm by default. Works best with the plain greeter.')
75
77 '''
78 Announces the control that has the focus on startup.
79
80 @param kwargs: Arbitrary keyword arguments to pass to the task
81 @type kwargs: dictionary
82 @return: C{True} to allow other tasks to process this event.
83 @rtype: boolean
84 '''
85 AccessEngineAPI.sayWindow(self, cap='audtio', role='output',
86 text=_('GDM Login'), **kwargs)
87
88
89 por = AccessEngineAPI.findAccByPredicate(
90 lambda por: AccessEngineAPI.hasAccState('focused', kwargs['por']))
91
92 AccessEngineAPI.setAccPOR(por)
93 kwargs['por'] = por
94 self.doTask('pointer to por', 'ReviewScript', **kwargs)
95 return False
96
98 '''
99 Announces the changing label of the text box as it serves dual duty as the
100 username and password field.
101
102 @param kwargs: Arbitrary keyword arguments to pass to the task
103 @type kwargs: dictionary
104 @return: C{True} to allow other tasks to process this event.
105 @rtype: boolean
106 '''
107 if not text and text_offset == 0 and added is not None:
108 if added:
109 if not self.first:
110 self.doTask('pointer to por', 'ReviewScript', **kwargs)
111 self.first = False
112 return False
113