Mercurial > libervia-backend
changeset 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 | acfc481629ac |
children | 221478058d8a |
files | src/tools/common/template_xmlui.py |
diffstat | 1 files changed, 10 insertions(+), 4 deletions(-) [+] |
line wrap: on
line diff
--- a/src/tools/common/template_xmlui.py Fri Oct 27 18:08:53 2017 +0200 +++ b/src/tools/common/template_xmlui.py Fri Oct 27 18:11:20 2017 +0200 @@ -75,11 +75,17 @@ @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):