1 '''
2 Defines a gtk dialog with a yes/no option for enabling desktop accessibility.
3
4 @note: Current implementation is AT-SPI, GNOME dependent
5
6 @author: Peter Parente
7 @organization: IBM Corporation
8 @copyright: Copyright (c) 2007 IBM Corporation
9 @license: The BSD License
10
11 @author: Frank Zenker
12 @organization: IT Science Center Ruegen gGmbH, Germany
13 @copyright: Copyright (c) 2007, 2008 ITSC Ruegen
14 @license: The BSD License
15
16 All rights reserved. This program and the accompanying materials are made
17 available under the terms of the BSD license which accompanies
18 this distribution, and is available at
19 U{http://www.opensource.org/licenses/bsd-license.php}
20 '''
21
22 import pygtk
23 pygtk.require('2.0')
24 import gtk, gobject
25 import gconf
26 from AccessEngine import AEChooser
27 from Tools.i18n import _
28
29 __uie__ = dict(kind='chooser')
30
32 '''
33 Shows a dialog that lets the user choose whether to enable or disable
34 desktop accessibility at startup.
35
36 @ivar dialog: Message dialog
37 @type dialog: gtk.MessageDialog
38 '''
39 - def init(self, **kwargs):
40 '''
41 Creates and shows the chooser dialog and its components.
42 '''
43
44 self.dialog = gtk.MessageDialog(type=gtk.MESSAGE_WARNING,
45 buttons=gtk.BUTTONS_YES_NO)
46 self.dialog.set_title(_('Desktop accessibility disabled'))
47 self.dialog.set_property('text',
48 _('SUE cannot see the applications on your desktop. You'
49 ' must enabled desktop accessibility to fix this '
50 ' problem. Do you want to enable it now?'))
51 self.dialog.set_property('secondary-text',
52 _('Note: Changes take effect after logout.'))
53 self.dialog.set_property('use-markup', False)
54 self.dialog.show_all()
55
56 self.dialog.connect('response', self._onResponse)
57
59 '''
60 Processes the yes/no response and closes the dialog.
61
62 @param widget: Source of GUI event
63 @type widget: gtk.Widget
64 '''
65 if response == gtk.RESPONSE_YES:
66 cl = gconf.client_get_default()
67 cl.set_bool('/desktop/gnome/interface/accessibility', True)
68 self.close()
69
71 '''
72 Closes the chooser, preventing further interaction with the user.
73 '''
74 self.dialog.destroy()
75
77 '''
78 Gets the name of the chooser.
79
80 @return: Human readable name of the chooser
81 @rtype: string
82 '''
83 return _('Accessibility message dialog')
84