diff tools/memory.py @ 66:8147b4f40809

SàT: multi-profile: DBus signals and frontend adaptation (first draft) - Quick App: new single_profile parameter in __init__ (default: yes), used to tell if the application use only one profile at the time or not - Quick App: new __check_profile method, tell if the profile is used by the current frontend - Quick App: new methods plug_profile, unplug_profile and clear_profile, must be called by the frontend to tell which profiles to use - DBus Bridge: new methods getProfileName, getProfilesList and createProfile
author Goffi <goffi@goffi.org>
date Wed, 03 Feb 2010 23:35:57 +1100
parents d35c5edab53f
children 9b842086d915
line wrap: on
line diff
--- a/tools/memory.py	Sun Jan 31 15:57:03 2010 +1100
+++ b/tools/memory.py	Wed Feb 03 23:35:57 2010 +1100
@@ -117,7 +117,7 @@
     def getProfilesList(self):
         return self.params.keys()
 
-    def createProfile(self, name, default=False):
+    def createProfile(self, name):
         """Create a new profile
         @param name: Name of the profile
         @param default: True if default value"""
@@ -135,12 +135,12 @@
         @return: requested profile name or None if it doesn't exist"""
         if profile_key=='@DEFAULT@':
             if not self.params:
-                return None
+                return ""
             info('No default profile, returning first one') #TODO: manage real default profile
             return self.params.keys()[0]  #FIXME: gof: temporary, must use real default value, and fallback to first one if it doesn't exists
         if not self.params.has_key(profile_key):
             error ('Trying to access an unknown profile')
-            return None
+            return ""
         return profile_key
 
     def __get_unique_node(self, parent, tag, name):
@@ -354,7 +354,7 @@
             print "clique",node.toxml()
         else:
             self.params[profile][(category, name)] = value
-            self.host.bridge.paramUpdate(name, value, category) #TODO: add profile in signal
+            self.host.bridge.paramUpdate(name, value, category, profile) #TODO: add profile in signal
 
 class Memory:
     """This class manage all persistent informations"""
@@ -605,8 +605,8 @@
     def getParams(self):
         return self.params.getParams() 
     
-    def getParamsForCategory(self, category):
-        return self.params.getParamsForCategory(category) 
+    def getParamsForCategory(self, category, profile_key='@DEFAULT@'):
+        return self.params.getParamsForCategory(category, profile_key) 
     
     def getParamsCategories(self):
         return self.params.getParamsCategories()