comparison src/tools/xml_tools.py @ 820:462f2052af26

core(XMLUI): empty options in ListWidget now just show a warning message, no more assert
author Goffi <goffi@goffi.org>
date Thu, 13 Feb 2014 18:50:49 +0100
parents 1fe00f0c9a91
children 97ee7594c788
comparison
equal deleted inserted replaced
819:9e3641ea648f 820:462f2052af26
606 606
607 def __init__(self, xmlui, options, value=None, style=None, name=None, parent=None): 607 def __init__(self, xmlui, options, value=None, style=None, name=None, parent=None):
608 if style is None: 608 if style is None:
609 style = set() 609 style = set()
610 styles = set(style) 610 styles = set(style)
611 assert options 611 if not options:
612 warning(_('empty "options" list'))
612 if not styles.issubset(['multi']): 613 if not styles.issubset(['multi']):
613 raise exceptions.DataError(_("invalid styles")) 614 raise exceptions.DataError(_("invalid styles"))
614 super(ListWidget, self).__init__(xmlui, name, parent) 615 super(ListWidget, self).__init__(xmlui, name, parent)
615 self.addOptions(options) 616 self.addOptions(options)
616 if value: 617 if value: