Mercurial > libervia-backend
comparison src/tools/memory.py @ 392:20f11097d99b
memory: general param default value fix
author | Goffi <goffi@goffi.org> |
---|---|
date | Thu, 29 Sep 2011 15:13:54 +0200 |
parents | e83d0c21d64d |
children | 79fe50fc8edc |
comparison
equal
deleted
inserted
replaced
391:c34fd9d6242e | 392:20f11097d99b |
---|---|
359 categories=[] | 359 categories=[] |
360 for cat in self.dom.getElementsByTagName("category"): | 360 for cat in self.dom.getElementsByTagName("category"): |
361 categories.append(cat.getAttribute("name")) | 361 categories.append(cat.getAttribute("name")) |
362 return categories | 362 return categories |
363 | 363 |
364 def setParam(self, name, value, category, profile_key): | 364 def setParam(self, name, value, category, profile_key='@NONE@'): |
365 """Set a parameter, return None if the parameter is not in param xml""" | 365 """Set a parameter, return None if the parameter is not in param xml""" |
366 profile = self.getProfileName(profile_key) | 366 if profile_key!="@NONE@": |
367 if not profile: | 367 profile = self.getProfileName(profile_key) |
368 error(_('Trying to set parameter for an unknown profile')) | 368 if not profile: |
369 return #TODO: throw an error | 369 error(_('Trying to set parameter for an unknown profile')) |
370 return #TODO: throw an error | |
370 | 371 |
371 node = self.__getParamNode(name, category, '@ALL@') | 372 node = self.__getParamNode(name, category, '@ALL@') |
372 if not node: | 373 if not node: |
373 error(_('Requesting an unknown parameter (%(category)s/%(name)s)') % {'category':category, 'name':name}) | 374 error(_('Requesting an unknown parameter (%(category)s/%(name)s)') % {'category':category, 'name':name}) |
374 return | 375 return |
375 | 376 |
376 if node[0] == 'general': | 377 if node[0] == 'general': |
377 self.params_gen[(category, name)] = value | 378 self.params_gen[(category, name)] = value |
378 self.host.bridge.paramUpdate(name, value, category, profile) #TODO: add profile in signal | 379 for profile in self.getProfilesList(): |
380 if self.host.isConnected(profile): | |
381 self.host.bridge.paramUpdate(name, value, category, profile) | |
379 return | 382 return |
380 | 383 |
381 assert (node[0] == 'individual') | 384 assert (node[0] == 'individual') |
385 assert (profile_key != "@NONE@") | |
382 | 386 |
383 type = node[1].getAttribute("type") | 387 type = node[1].getAttribute("type") |
384 if type=="button": | 388 if type=="button": |
385 print "clique",node.toxml() | 389 print "clique",node.toxml() |
386 else: | 390 else: |