[orca/new-settings] Added some failback values and fixed some var names



commit 42ff32f943c556ad0c73a490f6d55169ed4a3065
Author: Juanje Ojeda <jojeda emergya es>
Date:   Mon Oct 25 17:02:38 2010 +0200

    Added some failback values and fixed some var names

 src/orca/backends/yaml_backend.py |    8 ++++----
 src/orca/settings_manager.py      |   14 +++++++-------
 2 files changed, 11 insertions(+), 11 deletions(-)
---
diff --git a/src/orca/backends/yaml_backend.py b/src/orca/backends/yaml_backend.py
index 724cc95..98ac5b0 100644
--- a/src/orca/backends/yaml_backend.py
+++ b/src/orca/backends/yaml_backend.py
@@ -49,7 +49,7 @@ class Backend():
         dump(prefs, settingsFile)
         settingsFile.close()
 
-    def saveProfileSettings(self, profile, general,
+    def saveProfileSettings(self, profile='default', general,
                                   pronunciations, keybindings):
         profilePrefs = {profile: general,
                         'pronunciations': pronunciations,
@@ -71,7 +71,7 @@ class Backend():
         self.keybindings = prefs['keybindings']
         self.profiles = prefs['profiles']
 
-    def getGeneral(self, profile):
+    def getGeneral(self, profile='default'):
         self._getSettings()
         generalSettings = {}
         profileSettings = self.profiles[profile]
@@ -80,7 +80,7 @@ class Backend():
                 generalSettings[key] = value
         return generalSettings
 
-    def getPronunciations(self, profile):
+    def getPronunciations(self, profile='default'):
         self._getSettings()
         pronunciations = {}
         profileSettings = self.profiles[profile]
@@ -88,7 +88,7 @@ class Backend():
             pronunciations = profileSettings['pronunciations']
         return pronunciations
 
-    def getKeybindings(self, profile):
+    def getKeybindings(self, profile='default'):
         self._getSettings()
         keybindings = {}
         profileSettings = self.profiles[profile]
diff --git a/src/orca/settings_manager.py b/src/orca/settings_manager.py
index dac6c58..b78c011 100644
--- a/src/orca/settings_manager.py
+++ b/src/orca/settings_manager.py
@@ -171,7 +171,7 @@ class SettingsManager():
                         except:
                             print "Something wrong with - ", key
                 else:
-                   value = prefsDict[key]
+                    value = prefsDict[key]
             return value
 
         for key in prefs.keys():
@@ -209,16 +209,16 @@ class SettingsManager():
         change from one profile to another."""
         if profile is None:
             profile = self.profile
-        self.profileGeneral = self._getGeneral(profile)
-        self.profilePronunciations = self._getPronunciations(profile)
-        self.profileKeybindings = self._getKeybindings(profile)
+        self.profileGeneral = self._getGeneral(profile) or {}
+        self.profilePronunciations = self._getPronunciations(profile) or {}
+        self.profileKeybindings = self._getKeybindings(profile) or {}
 
     def _mergeSettings(self):
         """Update the changed values on the profile settings
         over the current and active settings"""
-        profileGeneral = self._getRealValues(self.profileGeneral)
-        self.general.update(self.profileGeneral)
-        self.pronunciations.update(self.profilePronunciation)
+        profileGeneral = self._getRealValues(self.profileGeneral) or {}
+        self.general.update(profileGeneral)
+        self.pronunciations.update(self.profilePronunciations)
         self.keybindings.update(self.profileKeybindings)
 
     def _enableAccessibility(self):



[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]