[orca/new-settings] Some fix for the settings_manager api and finished the yaml methods for getting the profiles setting
- From: Juanje Ojeda Croissier <jojeda src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [orca/new-settings] Some fix for the settings_manager api and finished the yaml methods for getting the profiles setting
- Date: Mon, 25 Oct 2010 11:50:43 +0000 (UTC)
commit 70bc5881e28c29e125db0969a98567fbbe694403
Author: Juanje Ojeda <jojeda emergya es>
Date: Mon Oct 25 13:49:33 2010 +0200
Some fix for the settings_manager api and finished the yaml methods for getting the profiles settings
src/orca/backends/yaml_backend.py | 20 +++++++++++++++++---
src/orca/settings_manager.py | 10 +++++++---
2 files changed, 24 insertions(+), 6 deletions(-)
---
diff --git a/src/orca/backends/yaml_backend.py b/src/orca/backends/yaml_backend.py
index 0f12ab5..724cc95 100644
--- a/src/orca/backends/yaml_backend.py
+++ b/src/orca/backends/yaml_backend.py
@@ -69,18 +69,32 @@ class Backend():
self.general = prefs['general']
self.pronunciations = prefs['pronunciations']
self.keybindings = prefs['keybindings']
+ self.profiles = prefs['profiles']
def getGeneral(self, profile):
self._getSettings()
- return self.profiles[profile]
+ generalSettings = {}
+ profileSettings = self.profiles[profile]
+ for key, value in profileSettings:
+ if key not in ['pronunciations', 'keybindings']:
+ generalSettings[key] = value
+ return generalSettings
def getPronunciations(self, profile):
self._getSettings()
- return self.profiles[profile]
+ pronunciations = {}
+ profileSettings = self.profiles[profile]
+ if profileSettings.has_key('pronunciations'):
+ pronunciations = profileSettings['pronunciations']
+ return pronunciations
def getKeybindings(self, profile):
self._getSettings()
- return self.keybindings[profile]
+ keybindings = {}
+ profileSettings = self.profiles[profile]
+ if profileSettings.has_key('keybindings'):
+ keybindings = profileSettings['keybindings']
+ return keybindings
def isFirstStart(self):
if os.path.exists(self.settingsFile):
diff --git a/src/orca/settings_manager.py b/src/orca/settings_manager.py
index 868859f..dac6c58 100644
--- a/src/orca/settings_manager.py
+++ b/src/orca/settings_manager.py
@@ -186,15 +186,19 @@ class SettingsManager():
generalSettings = self._backend.getGeneral(profile)
self.profileGeneral = generalSettings
- def _getPronunciations(self):
+ def _getPronunciations(self, profile=None):
"""Get from the active backend the pronunciations settings for
the current profile"""
+ if profile is None:
+ profile = self.profile
pronunciationsSettings = self._backend.getPronunciations(self.profile)
self.profilePronunciations = pronunciationsSettings
- def _getKeybindings(self):
+ def _getKeybindings(self, profile=None):
"""Get from the active backend the keybindings settings for
the current profile"""
+ if profile is None:
+ profile = self.profile
keybindingsSettings = self._backend.getKeybindings(self.profile)
self.profileKeybindings = keybindingsSettings
@@ -237,7 +241,7 @@ class SettingsManager():
and updated the current settings with them."""
self.profile = profile
self._loadProfileSettings(profile)
- self.mergeSettings()
+ self._mergeSettings()
def getGeneralSettings(self):
"""Return the current general settings.
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]