# HG changeset patch # User Goffi # Date 1281067843 -28800 # Node ID f494cba56a9e2f80f80c9213b9294f3c03b5f958 # Parent 2fa58703f1b7b3c74c04747c94c88dc8bf10778f xml tools: pairs layout is not used anymore if there is no label in dataForm2xml diff -r 2fa58703f1b7 -r f494cba56a9e tools/xml_tools.py --- a/tools/xml_tools.py Wed Aug 04 17:57:51 2010 +0800 +++ b/tools/xml_tools.py Fri Aug 06 12:10:43 2010 +0800 @@ -35,7 +35,10 @@ 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 @@ 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()