[orca/new-settings] Rewritten in a more modern way the load of yaml file for the importation.



commit b44904a25d45c2b382a418885e3355891d72f44a
Author: Juanje Ojeda <jojeda emergya es>
Date:   Mon Nov 1 18:34:02 2010 +0100

    Rewritten in a more modern way the load of yaml file for the importation.

 src/orca/settings_manager.py |   11 ++++-------
 1 files changed, 4 insertions(+), 7 deletions(-)
---
diff --git a/src/orca/settings_manager.py b/src/orca/settings_manager.py
index d3e6a79..279e9b3 100644
--- a/src/orca/settings_manager.py
+++ b/src/orca/settings_manager.py
@@ -337,6 +337,7 @@ class SettingsManager():
         self._setProfileGeneral(general)
         self._setProfilePronunciations(pronunciations)
         self._setProfileKeybindings(keybindings)
+
         self._backend.saveProfileSettings(self.profile,
                                           self.profileGeneral,
                                           self.profilePronunciations,
@@ -389,7 +390,6 @@ class SettingsManager():
         """Set firstStart. This user-configurable settting is primarily
         intended to serve as an indication as to whether or not initial
         configuration is needed."""
-
         if not self.isClassic():
             self._backend.setFirstStart(value)
 
@@ -402,12 +402,9 @@ class SettingsManager():
     def importProfile(self, fileName):
         """Import profile from a given filename"""
 
-        try:
-            profileFile = open(fileName)
-        except:
-            return False
-
-        prefs = load(profileFile)
+        prefs = {}
+        with open(fileName) as settingsFile:
+            prefs = load(settingsFile)
 
         general = {}
 



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