/usr/share/pyshared/pyatspi/__init__.py is in python-pyatspi 1.32.0-1ubuntu1.
This file is owned by root:root, with mode 0o644.
The actual contents of the file can be viewed below.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 | '''
Wraps the Gnome Assistive Technology Service Provider Interface for use in
Python. Imports the bonobo and ORBit modules. Initializes the ORBit ORB.
Activates the bonobo Accessibility Registry. Loads the Accessibility typelib
and imports the classes implementing the AT-SPI interfaces.
@var Registry: Reference to the AT-SPI registry daemon intialized on successful
import
@type Registry: registry.Registry
@author: Peter Parente
@organization: IBM Corporation
@copyright: Copyright (c) 2005, 2007 IBM Corporation
@license: LGPL
This library is free software; you can redistribute it and/or
modify it under the terms of the GNU Library General Public
License as published by the Free Software Foundation; either
version 2 of the License, or (at your option) any later version.
This library is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
Library General Public License for more details.
You should have received a copy of the GNU Library General Public
License along with this library; if not, write to the
Free Software Foundation, Inc., 59 Temple Place - Suite 330,
Boston, MA 02111-1307, USA.
Portions of this code originally licensed and copyright (c) 2005, 2007
IBM Corporation under the BSD license, available at
U{http://www.opensource.org/licenses/bsd-license.php}
'''
# Do not replace yourself if you've been imported explicitly by name
# already.
#
import sys
if not sys.modules.has_key('pyatspi_corba'):
try:
gconf = None
gconfClient = None
import gconf
gconfClient = gconf.client_get_default()
useDbus = \
gconfClient.get_bool("/desktop/gnome/interface/at-spi-dbus")
except:
useDbus = False
finally:
del gconfClient
del gconf
else:
useDbus = False
if useDbus:
import pyatspi_dbus
sys.modules['pyatspi'] = pyatspi_dbus
else:
__version__ = (1, 32, 0)
REGISTRY_IID = "OAFIID:Accessibility_Registry:1.0"
TYPELIB_NAME = "Accessibility"
# import ORBit and bonobo first (required)
import ORBit, bonobo
# initialize the ORB
orb = ORBit.CORBA.ORB_init()
# get a reference to the gnome Accessibility registry
try:
reg = bonobo.activation.activate_from_id(REGISTRY_IID, 0, 0)
except Exception:
reg = None
# generate Python code for the Accessibility module from the IDL
ORBit.load_typelib(TYPELIB_NAME)
# import our registry module
import registry
# wrap the raw registry object in our convenience singleton
Registry = registry.Registry(reg)
# overwrite the registry class in the module, so all other imports get our
# singleton
registry.Registry = Registry
# now throw the module away immediately
del registry
# pull the cache level functions into this namespace, but nothing else
from accessible import setCacheLevel, getCacheLevel, clearCache, printCache
# pull constants and utilities directly into this namespace; rest of code
# never has to be touched externally
from constants import *
from utils import *
# throw away extra references
del reg
del orb
del sys
del useDbus
|