3
# Copyright 2004-2007 Sun Microsystems Inc.
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.
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.
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.
20
""" Custom script for gnome-panel
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."
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
38
from orca.orca_i18n import _
40
########################################################################
42
# The gnome-panel script class. #
44
########################################################################
46
class Script(default.Script):
48
def __init__(self, app):
49
"""Creates a new script for gnome-terminal
52
- app: the application to create a script for.
55
# Set the debug level for all the methods in this script.
57
self.debugLevel = debug.LEVEL_FINEST
59
self._debug("__init__")
60
default.Script.__init__(self, app)
62
def _debug(self, msg):
63
""" Convenience method for printing debug messages
65
debug.println(self.debugLevel, "gnome-panel.py: "+msg)
67
def onStateChanged(self, event):
68
"""Called whenever an object's state changes.
75
self._debug("onStateChanged: '%s' %s (%d, %d)" % \
76
(obj.name, event.type, event.detail1, event.detail2))
78
# Handle tooltip popups.
80
if obj.role == rolenames.ROLE_TOOL_TIP:
81
if event.type == "object:state-changed:showing" and \
83
braille.displayMessage(obj.name)
84
speech.speak(obj.name)
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)
91
default.Script.onStateChanged(self, event)