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

« back to all changes in this revision

Viewing changes to src/orca/scripts/gnome-panel.py

  • Committer: Bazaar Package Importer
  • Author(s): Daniel Holbach
  • Date: 2007-04-26 11:06:56 UTC
  • mfrom: (1.1.14 upstream)
  • Revision ID: james.westby@ubuntu.com-20070426110656-uwpmlvdkave5jwrg
Tags: 2.19.1-0ubuntu1
* Synchronized with Debian, remaining Ubuntu changes:
  - debian/control:
    - newer Depends/Build-Depends, add Packages python-orca-brlapi and
      python-orca-brlapi-dbg.
  - debian/patches/01_add_ubiquity-script.dpatch,
    debian/patches/01_libbrlapi_fix.dpatch,
    debian/patches/01_link_libbrlapi.dpatch,
    debian/patches/01_no_default_desktop_item.dpatch,
    debian/patches/02_libbrlapi_fix.dpatch: added patches.
  - debian/rules, debian/control:
    - use pycentral, build python packages.
  - debian/copyright, debian/README.Debian: give credit to Luke Yelavich.
  - debian/install: python2.4 -> python*, install *.so files to different
    package.
  - debian/watch: added.
* New upstream release.
* debian/control:
  - added python-gconf as Build-Depends and Depends.
  - set Maintainer: Ubuntu Accessibility Developers
    <ubuntu-accessibility-devel@lists.ubuntu.com>
* debian/patches/01_add_ubiquity-script.dpatch:
  - updated.
* debian/patches/01_no_default_desktop_item.dpatch:
  - removed .rej file.

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 gnome-panel
 
21
"""
 
22
 
 
23
__id__        = "$Id: gnome-panel.py 2251 2007-04-05 01:42:41Z lmonsanto $"
 
24
__version__   = "$Revision: 2251 $"
 
25
__date__      = "$Date: 2007-04-04 18:42:41 -0700 (Wed, 04 Apr 2007) $"
 
26
__copyright__ = "Copyright (c) 2005-2007 Sun Microsystems Inc."
 
27
__license__   = "LGPL"
 
28
 
 
29
import orca.orca as orca
 
30
import orca.atspi as atspi
 
31
import orca.default as default
 
32
import orca.debug as debug
 
33
import orca.braille as braille
 
34
import orca.speech as speech
 
35
import orca.settings as settings
 
36
import orca.rolenames as rolenames
 
37
 
 
38
from orca.orca_i18n import _
 
39
 
 
40
########################################################################
 
41
#                                                                      #
 
42
# The gnome-panel script class.                                        #
 
43
#                                                                      #
 
44
########################################################################
 
45
 
 
46
class Script(default.Script):
 
47
 
 
48
    def __init__(self, app):
 
49
        """Creates a new script for gnome-terminal
 
50
 
 
51
        Arguments:
 
52
        - app: the application to create a script for.
 
53
        """
 
54
 
 
55
        # Set the debug level for all the methods in this script.
 
56
        #
 
57
        self.debugLevel = debug.LEVEL_FINEST
 
58
 
 
59
        self._debug("__init__")
 
60
        default.Script.__init__(self, app)
 
61
 
 
62
    def _debug(self, msg):
 
63
        """ Convenience method for printing debug messages
 
64
        """
 
65
        debug.println(self.debugLevel, "gnome-panel.py: "+msg)
 
66
 
 
67
    def onStateChanged(self, event):
 
68
        """Called whenever an object's state changes.
 
69
 
 
70
        Arguments:
 
71
        - event: the Event
 
72
        """
 
73
        obj = event.source
 
74
 
 
75
        self._debug("onStateChanged: '%s' %s (%d, %d)" % \
 
76
                    (obj.name, event.type, event.detail1, event.detail2))
 
77
 
 
78
        # Handle tooltip popups.
 
79
        #
 
80
        if obj.role == rolenames.ROLE_TOOL_TIP:
 
81
            if event.type == "object:state-changed:showing" and \
 
82
               event.detail1 == 1:
 
83
                braille.displayMessage(obj.name)
 
84
                speech.speak(obj.name)
 
85
 
 
86
            # Delete the cached accessible to force the AT-SPI to update
 
87
            # the accessible cache. Otherwise, the event references the
 
88
            # previous popup object.
 
89
            atspi.Accessible.deleteAccessible(obj._acc)
 
90
        else:
 
91
            default.Script.onStateChanged(self, event)