core (XMLUI): added value property for StringWidget and ListWidget
This commit is contained in:
parent
913e3712d0
commit
b845f7d49e
1 changed files with 11 additions and 0 deletions
|
|
@ -896,6 +896,10 @@ class StringWidget(InputWidget):
|
|||
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 @@ class ListWidget(InputWidget):
|
|||
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"""
|
||||
|
|
|
|||
Loading…
Reference in a new issue