~ubuntu-branches/ubuntu/hardy/gnome-orca/hardy

« back to all changes in this revision

Viewing changes to src/orca/scripts/notification-daemon.py

  • Committer: Bazaar Package Importer
  • Author(s): Luke Yelavich
  • Date: 2007-07-10 21:54:54 UTC
  • mfrom: (1.1.17 upstream)
  • Revision ID: james.westby@ubuntu.com-20070710215454-trky3o11pcc78qg4
Tags: 2.19.5-0ubuntu1
New upstream release.

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
1
# Orca
 
2
#
 
3
# Copyright 2004-2007 Sun Microsystems Inc.
 
4
#
 
5
# This library is free software; you can redistribute it and/or
 
6
# modify it under the terms of the GNU Library General Public
 
7
# License as published by the Free Software Foundation; either
 
8
# version 2 of the License, or (at your option) any later version.
 
9
#
 
10
# This library is distributed in the hope that it will be useful,
 
11
# but WITHOUT ANY WARRANTY; without even the implied warranty of
 
12
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
 
13
# Library General Public License for more details.
 
14
#
 
15
# You should have received a copy of the GNU Library General Public
 
16
# License along with this library; if not, write to the
 
17
# Free Software Foundation, Inc., 59 Temple Place - Suite 330,
 
18
# Boston, MA 02111-1307, USA.
 
19
 
 
20
""" Custom script for The notification daemon.
 
21
"""
 
22
 
 
23
__id__        = ""
 
24
__version__   = ""
 
25
__date__      = ""
 
26
__copyright__ = "Copyright (c) 2005-2007 Sun Microsystems Inc."
 
27
__license__   = "LGPL"
 
28
 
 
29
import orca.orca as orca
 
30
import orca.default as default
 
31
import orca.debug as debug
 
32
import orca.settings as settings
 
33
import orca.speech as speech
 
34
import orca.rolenames as rolenames
 
35
 
 
36
from orca.orca_i18n import _
 
37
 
 
38
########################################################################
 
39
#                                                                      #
 
40
# The notification-daemon script class.                                #
 
41
#                                                                      #
 
42
########################################################################
 
43
 
 
44
class Script(default.Script):
 
45
    def getListeners(self):
 
46
        """Sets up the AT-SPI event listeners for this script.
 
47
        """
 
48
        listeners = default.Script.getListeners(self)
 
49
 
 
50
        listeners["window:create"] = \
 
51
            self.onWindowCreate
 
52
 
 
53
        return listeners
 
54
 
 
55
    def onWindowCreate(self, event):
 
56
        """Called whenever a window is created in the notification-daemon
 
57
        application.
 
58
 
 
59
        Arguments:
 
60
        - event: the Event.
 
61
        """
 
62
        a = self.findByRole(event.source, rolenames.ROLE_LABEL)
 
63
        texts = [self.getDisplayedText(acc) for acc in a]
 
64
        # Translators: This denotes a notification to the user of some sort.
 
65
        #
 
66
        text = _('Notification %s') % ' '.join(texts)
 
67
        speech.speak(text, None, True)
 
68