[orca] Ensure 'orca -t' works even without a Desktop
- From: Joanmarie Diggs <joanied src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [orca] Ensure 'orca -t' works even without a Desktop
- Date: Wed, 28 Mar 2012 01:24:00 +0000 (UTC)
commit ae267e3f8d950079f46a2355a1b14742966f9974
Author: Joanmarie Diggs <jdiggs igalia com>
Date: Tue Mar 27 21:23:17 2012 -0400
Ensure 'orca -t' works even without a Desktop
src/orca/settings_manager.py | 22 +++++++++++++++++-----
1 files changed, 17 insertions(+), 5 deletions(-)
---
diff --git a/src/orca/settings_manager.py b/src/orca/settings_manager.py
index edd25f4..2876915 100644
--- a/src/orca/settings_manager.py
+++ b/src/orca/settings_manager.py
@@ -39,11 +39,14 @@ from keybindings import KeyBinding
import settings
import pronunciation_dict
-_dbusLoop = DBusGMainLoop()
-_bus = dbus.SessionBus(mainloop=_dbusLoop)
-_proxy = _bus.get_object("org.a11y.Bus", "/org/a11y/bus")
-_desktopProps = \
- dbus.Interface(_proxy, dbus_interface='org.freedesktop.DBus.Properties')
+try:
+ _dbusLoop = DBusGMainLoop()
+ _bus = dbus.SessionBus(mainloop=_dbusLoop)
+ _proxy = _bus.get_object("org.a11y.Bus", "/org/a11y/bus")
+ _desktopProps = \
+ dbus.Interface(_proxy, dbus_interface='org.freedesktop.DBus.Properties')
+except:
+ _desktopProps = None
class SettingsManager(object):
"""Settings backend manager. This class manages orca user's settings
@@ -304,9 +307,15 @@ class SettingsManager(object):
return not alreadyEnabled
def isAccessibilityEnabled(self):
+ if not _desktopProps:
+ return False
+
return bool(_desktopProps.Get('org.a11y.Status', 'IsEnabled'))
def setAccessibility(self, enable):
+ if not _desktopProps:
+ return False
+
_desktopProps.Set('org.a11y.Status', 'IsEnabled', enable)
return True
@@ -315,6 +324,9 @@ class SettingsManager(object):
this does not necessarily mean that Orca (or any other screen reader)
is running at the moment."""
+ if not _desktopProps:
+ return False
+
return bool(_desktopProps.Get('org.a11y.Status', 'ScreenReaderEnabled'))
def setStartingProfile(self, profile=None):
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]