[orca] Fix for bgo#622739 - Make bonobo optional
- From: Joanmarie Diggs <joanied src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [orca] Fix for bgo#622739 - Make bonobo optional
- Date: Mon, 28 Jun 2010 20:05:46 +0000 (UTC)
commit 469147ab928a2aaa4ad3b090540d8f6110f24faa
Author: Joanmarie Diggs <joanmarie diggs gmail com>
Date: Fri Jun 25 11:46:25 2010 -0400
Fix for bgo#622739 - Make bonobo optional
configure.in | 9 ++++++---
src/orca/gnomespeechfactory.py | 37 +++++++++++++++++++++++++++----------
src/orca/mag.py | 2 +-
src/orca/orca_console_prefs.py | 8 +++++---
src/orca/settings.py | 2 +-
5 files changed, 40 insertions(+), 18 deletions(-)
---
diff --git a/configure.in b/configure.in
index 1e7eb41..473c8de 100644
--- a/configure.in
+++ b/configure.in
@@ -46,9 +46,9 @@ AM_CHECK_PYMOD(gobject,,,[AC_MSG_ERROR(Could not find python module: gobject)])
# if DISPLAY is not set, and we don't like that.
#AM_CHECK_PYMOD(gtk,gdk,,[AC_MSG_ERROR(Could not find python module: gtk.gdk)])
AM_CHECK_PYMOD(gconf,,,[AC_MSG_ERROR(Could not find python module: gconf)])
-AM_CHECK_PYMOD(ORBit,,,[AC_MSG_ERROR(Could not find python module: ORBit)])
-AM_CHECK_PYMOD(ORBit,CORBA,,[AC_MSG_ERROR(Could not find python module: ORBit.CORBA)])
-AM_CHECK_PYMOD(bonobo,,,[AC_MSG_ERROR(Could not find python module: bonobo)])
+AM_CHECK_PYMOD(ORBit,,[ORBit_available="yes"],[ORBit_available="no"])
+AM_CHECK_PYMOD(ORBit,CORBA,[CORBA_available="yes"],[CORBA_available="no"])
+AM_CHECK_PYMOD(bonobo,,[bonobo_available="yes"],[bonobo_available="no"])
AM_CHECK_PYMOD(dbus,,,[AC_MSG_ERROR(Could not find python module: dbus)])
AM_CHECK_PYMOD(pyatspi,,,[AC_MSG_ERROR(Could not find python module: pyatspi)])
AM_CHECK_PYMOD(cairo,,,[AC_MSG_ERROR(Could not find python module: cairo)])
@@ -128,6 +128,9 @@ echo
echo "NOTE: Mouse review requires wnck, which was not found."
fi
echo
+echo Use ORBit: $ORBit_available
+echo Use CORBA: $CORBA_available
+echo Use bonobo: $bonobo_available
echo Use gnome-speech: $gnome_speech_available
echo Use gnome-mag: $gnome_mag_available
echo Use brltty: $brlapi_available
diff --git a/src/orca/gnomespeechfactory.py b/src/orca/gnomespeechfactory.py
index c34b4b1..87b5356 100644
--- a/src/orca/gnomespeechfactory.py
+++ b/src/orca/gnomespeechfactory.py
@@ -33,12 +33,18 @@ import Queue
import threading
import time
-import bonobo
-import ORBit
+_gnomespeechAvailable = False
-# Init the ORB if we need to. With AT-SPI/CORBA, we depend upon the pyatspi
-# implementation to init the ORB for us. [[[WDW: With AT-SPI/D-Bus, we need
-# to do it ourselves. I'm not sure how to ask ORBit itself if it's been
+try:
+ import bonobo
+ import ORBit
+ _gnomespeechAvailable = True
+except:
+ pass
+
+# Init the ORB if we need to. With AT-SPI/CORBA, we depend upon the pyatspi
+# implementation to init the ORB for us. [[[WDW: With AT-SPI/D-Bus, we need
+# to do it ourselves. I'm not sure how to ask ORBit itself if it's been
# init'ed yet, so I do so indirectly by looking for an attribute of pyatspi.
# This attribute has been set if AT-SPI/CORBA is in use and it not set if
# AT-SPI/D-Bus is in use.]]]
@@ -47,7 +53,8 @@ try:
import pyatspi
poa = pyatspi.Accessibility__POA
except AttributeError:
- orb = ORBit.CORBA.ORB_init()
+ if _gnomespeechAvailable:
+ orb = ORBit.CORBA.ORB_init()
import chnames
import debug
@@ -192,6 +199,9 @@ class SpeechServer(speechserver.SpeechServer):
def __activateDriver(iid):
+ if not _gnomespeechAvailable:
+ return None
+
# We know what we are doing here, so tell pylint not to flag
# the _narrow method call as a warning. The disable-msg is
# localized to just this method.
@@ -245,8 +255,10 @@ class SpeechServer(speechserver.SpeechServer):
# Get a list of all the drivers on the system and find out how many
# of them work.
#
- knownServers = bonobo.activation.query(
- "repo_ids.has('IDL:GNOME/Speech/SynthesisDriver:0.3')")
+ knownServers = []
+ if _gnomespeechAvailable:
+ knownServers = bonobo.activation.query(
+ "repo_ids.has('IDL:GNOME/Speech/SynthesisDriver:0.3')")
for server in knownServers:
if server.iid not in SpeechServer.__activeServers:
@@ -264,6 +276,9 @@ class SpeechServer(speechserver.SpeechServer):
See SpeechServer.getInfo() for more info.
"""
+ if not _gnomespeechAvailable:
+ return None
+
if info and info[1] in SpeechServer.__activeServers:
return SpeechServer.__activeServers[info[1]]
@@ -1196,8 +1211,10 @@ class SpeechServer(speechserver.SpeechServer):
speakers = self.__speakers
self.shutdown()
- servers = bonobo.activation.query(
- "repo_ids.has('IDL:GNOME/Speech/SynthesisDriver:0.3')")
+ servers = []
+ if _gnomespeechAvailable:
+ servers = bonobo.activation.query(
+ "repo_ids.has('IDL:GNOME/Speech/SynthesisDriver:0.3')")
for server in servers:
if server.iid == self.__iid:
diff --git a/src/orca/mag.py b/src/orca/mag.py
index 7563239..e196d2c 100644
--- a/src/orca/mag.py
+++ b/src/orca/mag.py
@@ -26,7 +26,6 @@ __date__ = "$Date$"
__copyright__ = "Copyright (c) 2005-2008 Sun Microsystems Inc."
__license__ = "LGPL"
-import bonobo
try:
# This can fail due to gtk not being available. We want to
# be able to recover from that if possible. The main driver
@@ -50,6 +49,7 @@ from orca_i18n import _ # for gettext support
_magnifierAvailable = False
try:
+ import bonobo
import ORBit
ORBit.load_typelib('GNOME_Magnifier')
import GNOME.Magnifier
diff --git a/src/orca/orca_console_prefs.py b/src/orca/orca_console_prefs.py
index c6c575f..b6839d2 100644
--- a/src/orca/orca_console_prefs.py
+++ b/src/orca/orca_console_prefs.py
@@ -612,12 +612,14 @@ def showPreferencesUI(commandLineSettings):
speechVoiceChoice)
time.sleep(2)
- import bonobo
import gobject
-
gobject.threads_init()
gobject.idle_add(logoutUser)
- bonobo.main()
+ try:
+ import bonobo
+ bonobo.main()
+ except:
+ pass
break
except:
stop = False
diff --git a/src/orca/settings.py b/src/orca/settings.py
index 4c644ac..8e3470d 100644
--- a/src/orca/settings.py
+++ b/src/orca/settings.py
@@ -885,7 +885,7 @@ useBlockPreventor = False
# If True, we use the bonobo main loop provided by bonobo to handle
# all events in atspi.py. If False, we create our own loop.
#
-useBonoboMain = True
+useBonoboMain = False
# If True, we handle events asynchronously - our normal mode of
# queueing events and processing them later on the gidle thread.
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]