changeset 392:20f11097d99b

memory: general param default value fix
author Goffi <goffi@goffi.org>
date Thu, 29 Sep 2011 15:13:54 +0200
parents c34fd9d6242e
children 393b35aa86d2
files src/tools/memory.py
diffstat 1 files changed, 10 insertions(+), 6 deletions(-) [+]
line wrap: on
line diff
--- a/src/tools/memory.py	Thu Sep 29 14:59:14 2011 +0200
+++ b/src/tools/memory.py	Thu Sep 29 15:13:54 2011 +0200
@@ -361,12 +361,13 @@
             categories.append(cat.getAttribute("name"))
         return categories
 
-    def setParam(self, name, value, category, profile_key):
+    def setParam(self, name, value, category, profile_key='@NONE@'):
         """Set a parameter, return None if the parameter is not in param xml"""
-        profile = self.getProfileName(profile_key)
-        if not profile:
-            error(_('Trying to set parameter for an unknown profile'))
-            return #TODO: throw an error
+        if profile_key!="@NONE@":
+            profile = self.getProfileName(profile_key)
+            if not profile:
+                error(_('Trying to set parameter for an unknown profile'))
+                return #TODO: throw an error
 
         node = self.__getParamNode(name, category, '@ALL@')
         if not node:
@@ -375,10 +376,13 @@
         
         if node[0] == 'general':
             self.params_gen[(category, name)] = value
-            self.host.bridge.paramUpdate(name, value, category, profile) #TODO: add profile in signal
+            for profile in self.getProfilesList():
+                if self.host.isConnected(profile):
+                    self.host.bridge.paramUpdate(name, value, category, profile)
             return
         
         assert (node[0] == 'individual')
+        assert (profile_key != "@NONE@")
         
         type = node[1].getAttribute("type")
         if type=="button":