[orca/new-settings] Move isAccessibilityEnabled and setAccessibility from settings to SettingsManager.
- From: Alejandro Leiva <aleiva src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [orca/new-settings] Move isAccessibilityEnabled and setAccessibility from settings to SettingsManager.
- Date: Thu, 28 Oct 2010 20:32:58 +0000 (UTC)
commit a12b785b332323cad622fd407fd4f50ba522c25b
Author: Alejandro Leiva <aleiva emergya es>
Date: Thu Oct 28 22:31:31 2010 +0200
Move isAccessibilityEnabled and setAccessibility from settings to SettingsManager.
src/orca/backends/classic_backend.py | 14 --------------
src/orca/backends/gconf_backend.py | 14 --------------
src/orca/orca.py | 2 +-
src/orca/orca_prefs.py | 4 ++--
src/orca/settings.py | 17 -----------------
src/orca/settings_manager.py | 24 ++++++++++++++++++++++--
6 files changed, 25 insertions(+), 50 deletions(-)
---
diff --git a/src/orca/backends/classic_backend.py b/src/orca/backends/classic_backend.py
index c5276aa..79ba2d3 100644
--- a/src/orca/backends/classic_backend.py
+++ b/src/orca/backends/classic_backend.py
@@ -142,20 +142,6 @@ class OrcaPrefs:
prefs.writelines(" except ImportError:\n")
prefs.writelines(" pass\n")
- def _enableAccessibility(self):
- """Enables the GNOME accessibility flag. Users need to log out and
- then back in for this to take effect.
-
- Returns True if an action was taken (i.e., accessibility was not
- set prior to this call).
- """
-
- alreadyEnabled = settings.isAccessibilityEnabled()
- if not alreadyEnabled:
- settings.setAccessibilityEnabled(True)
-
- return not alreadyEnabled
-
def _getDisplayString(self, display):
"""Returns a string that represents the source or target
magnifier display.
diff --git a/src/orca/backends/gconf_backend.py b/src/orca/backends/gconf_backend.py
index 11410ca..a6d7853 100644
--- a/src/orca/backends/gconf_backend.py
+++ b/src/orca/backends/gconf_backend.py
@@ -185,20 +185,6 @@ class Backend:
casts[type(value)](self._client, self.__app_key + '/' + \
name, value)
- def _enableAccessibility(self):
- """Enables the GNOME accessibility flag. Users need to log out and
- then back in for this to take effect.
-
- Returns True if an action was taken (i.e., accessibility was not
- set prior to this call).
- """
-
- alreadyEnabled = settings.isAccessibilityEnabled()
- if not alreadyEnabled:
- settings.setAccessibilityEnabled(True)
-
- return not alreadyEnabled
-
def writePreferences(self):
"""Creates the gconf schema and files to hold user preferences. Note
that callers of this method may want to consider using an ordered
diff --git a/src/orca/orca.py b/src/orca/orca.py
index f635a79..9eabe1d 100644
--- a/src/orca/orca.py
+++ b/src/orca/orca.py
@@ -2218,7 +2218,7 @@ def main():
# setting is typically not set since the gdm user does not
# have a home.
#
- a11yEnabled = settings.isAccessibilityEnabled()
+ a11yEnabled = _settingsManager.isAccessibilityEnabled()
if (not bypassSetup) and (not a11yEnabled):
_showPreferencesConsole()
die()
diff --git a/src/orca/orca_prefs.py b/src/orca/orca_prefs.py
index b47cd5a..b243cc4 100644
--- a/src/orca/orca_prefs.py
+++ b/src/orca/orca_prefs.py
@@ -149,9 +149,9 @@ class OrcaPrefs:
set prior to this call).
"""
- alreadyEnabled = settings.isAccessibilityEnabled()
+ alreadyEnabled = _settingsManager.isAccessibilityEnabled()
if not alreadyEnabled:
- settings.setAccessibilityEnabled(True)
+ _settingsManager.setAccessibilityEnabled(True)
return not alreadyEnabled
diff --git a/src/orca/settings.py b/src/orca/settings.py
index 9de5bc4..386b30c 100644
--- a/src/orca/settings.py
+++ b/src/orca/settings.py
@@ -983,23 +983,6 @@ chatAnnounceBuddyTyping = False
#
chatRoomHistories = False
-# Obtain/set information regarding whether accessibility is enabled
-# or not.
-#
-def isAccessibilityEnabled():
- try:
- return gconfClient.get_bool("/desktop/gnome/interface/accessibility") \
- or gconfClient.get_bool("/desktop/gnome/interface/accessibility2")
- except:
- return False
-
-def setAccessibilityEnabled(enable):
- try:
- return gconfClient.set_bool("/desktop/gnome/interface/accessibility",
- enable)
- except:
- return False
-
# Obtain/set information regarding whether Orca is autostarted for this
# user at login time.
#
diff --git a/src/orca/settings_manager.py b/src/orca/settings_manager.py
index 3fa7a21..aa81b8d 100644
--- a/src/orca/settings_manager.py
+++ b/src/orca/settings_manager.py
@@ -34,6 +34,12 @@ from keybindings import KeyBinding, KeyBindings
from yaml import load, dump
+try:
+ import gconf
+ gconfClient = gconf.client_get_default()
+except:
+ gconfClient = None
+
class SettingsManager():
"""Settings backend manager. This class manages orca user's settings
using different backends"""
@@ -216,12 +222,26 @@ class SettingsManager():
set prior to this call).
"""
- alreadyEnabled = settings.isAccessibilityEnabled()
+ alreadyEnabled = self.isAccessibilityEnabled()
if not alreadyEnabled:
- settings.setAccessibilityEnabled(True)
+ self.setAccessibilityEnabled(True)
return not alreadyEnabled
+ def isAccessibilityEnabled(self):
+ try:
+ return gconfClient.get_bool("/desktop/gnome/interface/accessibility") \
+ or gconfClient.get_bool("/desktop/gnome/interface/accessibility2")
+ except:
+ return False
+
+ def setAccessibility(self, enable):
+ try:
+ return gconfClient.set_bool("/desktop/gnome/interface/accessibility",
+ enable)
+ except:
+ return False
+
def setProfile(self, profile='default'):
"""Set a specific profile as the active one.
Also the settings from that profile will be loading
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]