diff 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
line wrap: on
line diff
--- a/tools/memory.py	Wed Jun 23 14:55:04 2010 +0800
+++ b/tools/memory.py	Wed Jun 23 17:26:21 2010 +0800
@@ -29,6 +29,7 @@
 import pdb
 from twisted.internet import defer
 from twisted.words.protocols.jabber import jid
+from tools.xml_tools import paramsXml2xmlUI
 
 SAVEFILE_PARAM_XML="/param" #xml parameters template
 SAVEFILE_PARAM_DATA="/param" #individual & general parameters; _ind and _gen suffixes will be added
@@ -281,6 +282,14 @@
         return prof_xml
 
 
+    def getParamsUI(self, profile_key='@DEFAULT'):
+        """Return a SàT XMLUI for parameters, with given profile"""
+        profile = self.getProfileName(profile_key)
+        if not profile:
+            error(_("Asking params for inexistant profile"))
+            return ""
+        param_xml = self.getParams(profile)
+        return paramsXml2xmlUI(param_xml)
 
     def getParams(self, profile_key='@DEFAULT@'):
         """Construct xml for asked profile
@@ -618,8 +627,11 @@
     def getParamA(self, name, category, attr="value", profile_key="@DEFAULT@"):
         return self.params.getParamA(name, category, attr, profile_key)
     
-    def getParams(self):
-        return self.params.getParams() 
+    def getParamsUI(self, profile_key='@DEFAULT@'):
+        return self.params.getParamsUI(profile_key)
+  
+    def getParams(self, profile_key='@DEFAULT@'):
+        return self.params.getParams(profile_key) 
     
     def getParamsForCategory(self, category, profile_key='@DEFAULT@'):
         return self.params.getParamsForCategory(category, profile_key)