# HG changeset patch # User Goffi # Date 1512070165 -3600 # Node ID bfd1e9d737c4030778dd66547e2119a45544e2f6 # Parent 0199c0bd4c6068dab8e6c87473b11d2fc1da613a core (XMLUI): added value property for StringWidget and ListWidget diff -r 0199c0bd4c60 -r bfd1e9d737c4 src/tools/xml_tools.py --- a/src/tools/xml_tools.py Thu Nov 30 20:27:22 2017 +0100 +++ b/src/tools/xml_tools.py Thu Nov 30 20:29:25 2017 +0100 @@ -896,6 +896,10 @@ value_elt.appendChild(text) self.elem.appendChild(value_elt) + @property + def value(self): + return self.elem.firstChild.firstChild.wholeText + class PasswordWidget(StringWidget): type = 'password' @@ -1020,6 +1024,13 @@ def setStyle(self, style): self.setStyles([style]) + @property + def value(self): + """Return the value of first selected option""" + for child in self.elem.childNodes: + if child.tagName == u'option' and child.getAttribute(u'selected') == u'true': + return child.getAttribute(u'value') + return u'' class JidsListWidget(InputWidget): """A list of text or jids where elements can be added/removed or modified"""