[orca/new-settings] Added new backend method, _setProfileKey() for changing just one key:value



commit 2e2a66eedb20b028a078edbe2b27b9d0f7fc4365
Author: Juanje Ojeda <jojeda emergya es>
Date:   Mon Nov 1 18:14:44 2010 +0100

    Added new backend method, _setProfileKey() for changing just one key:value

 src/orca/backends/yaml_backend.py |    8 ++++++++
 1 files changed, 8 insertions(+), 0 deletions(-)
---
diff --git a/src/orca/backends/yaml_backend.py b/src/orca/backends/yaml_backend.py
index 2d6f128..6a0d7fc 100644
--- a/src/orca/backends/yaml_backend.py
+++ b/src/orca/backends/yaml_backend.py
@@ -129,6 +129,14 @@ class Backend:
         generalSettings = self.getGeneral()
         return generalSettings.get('firstStart', True)
 
+    def _setProfileKey(self, key, value):
+        self.general[key] = value
+
+        with open(self.settingsFile, 'r+') as settingsFile:
+            prefs = load(settingsFile)
+            prefs['general'][key] = value
+            dump(prefs, settingsFile)
+
     def setFirstStart(self, value=False):
         """Set firstStart. This user-configurable settting is primarily
         intended to serve as an indication as to whether or not initial



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