Mercurial > libervia-backend
comparison src/tools/xml_tools.py @ 910:9754c0ebadba
core (XMLUI): BoolWidget now accept real boolean for value
author | Goffi <goffi@goffi.org> |
---|---|
date | Fri, 21 Mar 2014 15:03:56 +0100 |
parents | cad8e52bb2e6 |
children | 75f3b3b430ff |
comparison
equal
deleted
inserted
replaced
909:fab49a1d5ea2 | 910:9754c0ebadba |
---|---|
577 | 577 |
578 class BoolWidget(InputWidget): | 578 class BoolWidget(InputWidget): |
579 type = 'bool' | 579 type = 'bool' |
580 | 580 |
581 def __init__(self, xmlui, value='false', name=None, parent=None): | 581 def __init__(self, xmlui, value='false', name=None, parent=None): |
582 if value == '0': | 582 if isinstance(value, bool): |
583 value = 'true' if value else 'false' | |
584 elif value == '0': | |
583 value='false' | 585 value='false' |
584 elif value == '1': | 586 elif value == '1': |
585 value='true' | 587 value='true' |
586 if not value in ('true', 'false'): | 588 if not value in ('true', 'false'): |
587 raise exceptions.DataError(_("Value must be 0, 1, false or true")) | 589 raise exceptions.DataError(_("Value must be 0, 1, false or true")) |