[caribou] Make SettingsManager singleton



commit b1ba682af01576f294e71872551f576519627a30
Author: Eitan Isaacson <eitan monotonous org>
Date:   Tue May 3 16:31:46 2011 -0700

    Make SettingsManager singleton

 caribou/settings/setting_types.py |    7 +++++--
 1 files changed, 5 insertions(+), 2 deletions(-)
---
diff --git a/caribou/settings/setting_types.py b/caribou/settings/setting_types.py
index b0e374d..f58e2bb 100644
--- a/caribou/settings/setting_types.py
+++ b/caribou/settings/setting_types.py
@@ -58,10 +58,13 @@ class SettingsTopGroup(SettingsGroup):
         SettingsGroup.__init__(self, "_top", label, children)
         self.path = path
         self.schema_id = schema_id
+        self._manager = None
 
     def __call__(self):
-        from caribou.settings.settings_manager import SettingsManager
-        return SettingsManager(self)
+        if self._manager is None:
+            from caribou.settings.settings_manager import SettingsManager
+            self._manager =  SettingsManager(self)
+        return self._manager
 
 class ValueSetting(Setting):
     variant_type = ''



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