[at-spi] Additional work on bgo#606251 - Handle CORBA vs. D-Bus choice better This removes the *.pth hack fro
- From: William Walker <wwalker src gnome org>
- To: svn-commits-list gnome org
- Cc:
- Subject: [at-spi] Additional work on bgo#606251 - Handle CORBA vs. D-Bus choice better This removes the *.pth hack fro
- Date: Fri, 8 Jan 2010 21:00:22 +0000 (UTC)
commit ba1ff1363263bb28e9c6efbbf9e8095b22bb714e
Author: Willie Walker <william walker sun com>
Date: Fri Jan 8 15:58:03 2010 -0500
Additional work on bgo#606251 - Handle CORBA vs. D-Bus choice better
This removes the *.pth hack from the D-Bus side of the house if D-Bus is relocated.
pyatspi/__init__.py.in | 82 +++++++++++++++++++++++++++++------------------
1 files changed, 50 insertions(+), 32 deletions(-)
---
diff --git a/pyatspi/__init__.py.in b/pyatspi/__init__.py.in
index e929e75..27f89ed 100644
--- a/pyatspi/__init__.py.in
+++ b/pyatspi/__init__.py.in
@@ -33,41 +33,59 @@ IBM Corporation under the BSD license, available at
U{http://www.opensource.org/licenses/bsd-license.php}
'''
-__version__ = (@AT_SPI_MAJOR_VERSION@, @AT_SPI_MINOR_VERSION@, @AT_SPI_MICRO_VERSION@)
+try:
+ 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
-REGISTRY_IID = "OAFIID:Accessibility_Registry:1.0"
-TYPELIB_NAME = "Accessibility"
+if useDbus:
+ import sys
+ import pyatspi_dbus
+ sys.modules['pyatspi'] = pyatspi_dbus
+ del sys
+else:
+ __version__ = (@AT_SPI_MAJOR_VERSION@, @AT_SPI_MINOR_VERSION@, @AT_SPI_MICRO_VERSION@)
-# 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)
+ 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
-# 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 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 *
-# 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
-# throw away extra references
-del reg
-del orb
+del useDbus
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]