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
This commit is contained in:
Goffi 2010-06-23 17:26:21 +08:00
commit 923d2cd145
3 changed files with 80 additions and 12 deletions

View file

@ -85,6 +85,9 @@ class DBusBridgeFrontend(BridgeFrontend):
def getParamA(self, name, category, profile_key='@DEFAULT@'):
return self.db_comm_iface.getParamA(name, category, profile_key)
def getParamsUI(self, profile_key='@DEFAULT@'):
return self.db_comm_iface.getParamsUI(profile_key)
def getParams(self, profile_key='@DEFAULT@'):
return self.db_comm_iface.getParams(profile_key)

View file

@ -372,6 +372,8 @@ class MainWindow(wx.Frame, QuickApp):
def onParam(self, e):
debug(_("Param request"))
#xmlui = self.bridge.getParamsUI(self.profile)
#XMLUI(self, xml_data = xmlui)
param=Param(self)
def onExit(self, e):

View file

@ -87,6 +87,8 @@ class XMLUI(wx.Frame):
ctrl = wx.ListBox(parent, -1, choices=[option.getAttribute("value") for option in elem.getElementsByTagName("option")], style=wx.LB_SINGLE)
self.ctl_list.append({'name':name, 'type':type, 'control':ctrl})
_proportion = 1
elif type=="button":
pass
else:
error(_("FIXME FIXME FIXME: type [%s] is not implemented") % type) #FIXME !
raise NotImplementedError
@ -102,10 +104,12 @@ class XMLUI(wx.Frame):
if wanted and not node.nodeName in wanted:
raise Exception("Invalid XMLUI") #TODO: make a custom exception
if node.nodeName == "layout":
_proportion = 0
type = node.getAttribute('type')
if type == "tabs":
current = wx.Notebook(parent, -1, style=wx.NB_LEFT if self.type=='param' else 0)
self.__parseChilds(current, None, node, ['category'])
_proportion = 1
else:
if current_param == None:
current = wx.Panel(parent, -1)
@ -122,7 +126,7 @@ class XMLUI(wx.Frame):
current.SetSizer(current.sizer)
self.__parseElems(node, current)
if parent:
parent.sizer.Add(current, flag=wx.EXPAND)
parent.sizer.Add(current, _proportion, flag=wx.EXPAND)
elif node.nodeName == "category":
name = node.getAttribute('name')
if not node.nodeName in wanted or not name or not isinstance(parent,wx.Notebook):