comparison tools/memory.py @ 105:d2630fba8dfd

params to XMLUI tools - xml_tools: new paramsXml2xmlUI method, for conversion from params xml to User Interface XML - xml_tools: new addButton method - bridge: new method getParamsUI
author Goffi <goffi@goffi.org>
date Wed, 23 Jun 2010 17:26:21 +0800
parents db0a0f000e37
children 138d82f64b6f
comparison
equal deleted inserted replaced
104:5458ac1380cc 105:d2630fba8dfd
27 from xml.dom import minidom 27 from xml.dom import minidom
28 from logging import debug, info, error 28 from logging import debug, info, error
29 import pdb 29 import pdb
30 from twisted.internet import defer 30 from twisted.internet import defer
31 from twisted.words.protocols.jabber import jid 31 from twisted.words.protocols.jabber import jid
32 from tools.xml_tools import paramsXml2xmlUI
32 33
33 SAVEFILE_PARAM_XML="/param" #xml parameters template 34 SAVEFILE_PARAM_XML="/param" #xml parameters template
34 SAVEFILE_PARAM_DATA="/param" #individual & general parameters; _ind and _gen suffixes will be added 35 SAVEFILE_PARAM_DATA="/param" #individual & general parameters; _ind and _gen suffixes will be added
35 SAVEFILE_HISTORY="/history" 36 SAVEFILE_HISTORY="/history"
36 SAVEFILE_PRIVATE="/private" #file used to store misc values (mainly for plugins) 37 SAVEFILE_PRIVATE="/private" #file used to store misc values (mainly for plugins)
279 param_node.setAttribute('value', profile_value) 280 param_node.setAttribute('value', profile_value)
280 prof_xml.documentElement.appendChild(cat_copy) 281 prof_xml.documentElement.appendChild(cat_copy)
281 return prof_xml 282 return prof_xml
282 283
283 284
285 def getParamsUI(self, profile_key='@DEFAULT'):
286 """Return a SàT XMLUI for parameters, with given profile"""
287 profile = self.getProfileName(profile_key)
288 if not profile:
289 error(_("Asking params for inexistant profile"))
290 return ""
291 param_xml = self.getParams(profile)
292 return paramsXml2xmlUI(param_xml)
284 293
285 def getParams(self, profile_key='@DEFAULT@'): 294 def getParams(self, profile_key='@DEFAULT@'):
286 """Construct xml for asked profile 295 """Construct xml for asked profile
287 Take params xml as skeleton""" 296 Take params xml as skeleton"""
288 profile = self.getProfileName(profile_key) 297 profile = self.getProfileName(profile_key)
616 return self.presenceStatus[profile] 625 return self.presenceStatus[profile]
617 626
618 def getParamA(self, name, category, attr="value", profile_key="@DEFAULT@"): 627 def getParamA(self, name, category, attr="value", profile_key="@DEFAULT@"):
619 return self.params.getParamA(name, category, attr, profile_key) 628 return self.params.getParamA(name, category, attr, profile_key)
620 629
621 def getParams(self): 630 def getParamsUI(self, profile_key='@DEFAULT@'):
622 return self.params.getParams() 631 return self.params.getParamsUI(profile_key)
632
633 def getParams(self, profile_key='@DEFAULT@'):
634 return self.params.getParams(profile_key)
623 635
624 def getParamsForCategory(self, category, profile_key='@DEFAULT@'): 636 def getParamsForCategory(self, category, profile_key='@DEFAULT@'):
625 return self.params.getParamsForCategory(category, profile_key) 637 return self.params.getParamsForCategory(category, profile_key)
626 638
627 def getParamsCategories(self): 639 def getParamsCategories(self):