comparison src/tools/common/template_xmlui.py @ 2400:8253ea069781

template(XMLUI): added items property to ListWidget: this property get values and labels from items relevant for the current list, according to styles.
author Goffi <goffi@goffi.org>
date Fri, 27 Oct 2017 18:11:20 +0200
parents 7fff98d64ab5
children 8b37a62336c3
comparison
equal deleted inserted replaced
2399:acfc481629ac 2400:8253ea069781
73 def values(self): 73 def values(self):
74 return self.selected 74 return self.selected
75 75
76 @property 76 @property
77 def labels(self): 77 def labels(self):
78 ret = [] 78 """return only labels from self.items"""
79 for value, label in self.items:
80 yield label
81
82 @property
83 def items(self):
84 """return suitable items, according to style"""
85 no_select = self.no_select
79 for value,label in self.options: 86 for value,label in self.options:
80 if value in self.selected: 87 if no_select or value in self.selected:
81 ret.append(label) 88 yield value,label
82 return ret
83 89
84 @property 90 @property
85 def inline(self): 91 def inline(self):
86 return u'inline' in self.style 92 return u'inline' in self.style
87 93