[orca/new-settings] Finished the get[KindOfSettings] methods and added missed method for getting all the settings



commit 349a9c22642ebb5f22e98f1427e3cf37239a4abc
Author: Juanje Ojeda <jojeda emergya es>
Date:   Tue Oct 26 09:12:09 2010 +0200

    Finished the get[KindOfSettings] methods and added missed method for getting all the settings

 src/orca/backends/yaml_backend.py |   20 +++++++++++++++-----
 1 files changed, 15 insertions(+), 5 deletions(-)
---
diff --git a/src/orca/backends/yaml_backend.py b/src/orca/backends/yaml_backend.py
index 0c420d2..6b380db 100644
--- a/src/orca/backends/yaml_backend.py
+++ b/src/orca/backends/yaml_backend.py
@@ -42,7 +42,11 @@ class Backend:
 
     def saveDefaultSettings(self, general, pronunciations, keybindings):
         prefs = {'general': general,
-                 'profiles': { 'default': {} },
+                 'profiles': { 'default': { 'profile': ['Default', 'default'],
+                                            'pronunciations': {},
+                                            'keybindings': {}
+                                          }
+                             },
                  'pronunciations': pronunciations,
                  'keybindings': keybindings}
         settingsFile = open(self.settingsFile, 'w')
@@ -52,7 +56,7 @@ class Backend:
     def saveProfileSettings(self, profile, general,
                                   pronunciations, keybindings):
 
-        if (profile == None):
+        if profile is None:
             profile = 'default'
 
         profilePrefs = {profile: general,
@@ -77,7 +81,7 @@ class Backend:
 
     def getGeneral(self, profile='default'):
         self._getSettings()
-        generalSettings = {}
+        generalSettings = self.general
         profileSettings = self.profiles[profile]
         for key, value in profileSettings:
             if key not in ['pronunciations', 'keybindings']:
@@ -86,7 +90,7 @@ class Backend:
 
     def getPronunciations(self, profile='default'):
         self._getSettings()
-        pronunciations = {}
+        pronunciations = self.pronunciations
         profileSettings = self.profiles[profile]
         if profileSettings.has_key('pronunciations'):
             pronunciations = profileSettings['pronunciations']
@@ -94,12 +98,18 @@ class Backend:
 
     def getKeybindings(self, profile='default'):
         self._getSettings()
-        keybindings = {}
+        keybindings = self.keybindings
         profileSettings = self.profiles[profile]
         if profileSettings.has_key('keybindings'):
             keybindings = profileSettings['keybindings']
         return keybindings
 
+    def getPreferences(self, profile='default'):
+        general = getGeneral(profile)
+        pronunciations = getPronunciations(profile)
+        keybindings = getKeybindings(profile)
+        return (general, pronunciations, keybindings)
+
     def isFirstStart(self):
         if os.path.exists(self.settingsFile):
             return False



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