xml tools: pairs layout is not used anymore if there is no label in dataForm2xml
This commit is contained in:
parent
d1fd1cc04e
commit
209a82e076
1 changed files with 9 additions and 5 deletions
|
|
@ -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()
|
||||
|
|
|
|||
Loading…
Reference in a new issue