xml tools: pairs layout is not used anymore if there is no label in dataForm2xml

This commit is contained in:
Goffi 2010-08-06 12:10:43 +08:00
commit 209a82e076

View file

@ -35,7 +35,10 @@ def dataForm2xml(form):
if form.instructions:
form_ui.addText('\n'.join(form.instructions), 'instructions')
form_ui.changeLayout("pairs")
labels = filter(lambda field:field.label,form.fieldList)
if labels:
#if there is no label, we don't need to use pairs
form_ui.changeLayout("pairs")
for field in form.fieldList:
if field.fieldType == 'fixed':
@ -50,10 +53,11 @@ def dataForm2xml(form):
error (u"FIXME FIXME FIXME: Type [%s] is not managed yet by SàT" % field.fieldType)
__field_type = "string"
if field.label:
form_ui.addLabel(field.label)
else:
form_ui.addEmpty()
if labels:
if field.label:
form_ui.addLabel(field.label)
else:
form_ui.addEmpty()
elem = form_ui.addElement(__field_type, field.var, field.value, [option.value for option in field.options])
return form_ui.toXml()