template(XMLUI): added items property to ListWidget:

this property get values and labels from items relevant for the current list, according to styles.
This commit is contained in:
Goffi 2017-10-27 18:11:20 +02:00
commit d308bbfd6b

View file

@ -75,11 +75,17 @@ class OptionsWidget(Widget):
@property
def labels(self):
ret = []
"""return only labels from self.items"""
for value, label in self.items:
yield label
@property
def items(self):
"""return suitable items, according to style"""
no_select = self.no_select
for value,label in self.options:
if value in self.selected:
ret.append(label)
return ret
if no_select or value in self.selected:
yield value,label
@property
def inline(self):