comparison src/tools/xml_tools.py @ 1086:2cb30f46e560

core/frontends (XMLUI): value can now be inserted as a <value/> element, if not present value attribute is tested, else empty string is used.
author Goffi <goffi@goffi.org>
date Wed, 25 Jun 2014 14:01:57 +0200
parents 03dcb6ca7e49
children 018bdd687747
comparison
equal deleted inserted replaced
1085:7a39ae3950f7 1086:2cb30f46e560
607 """Used for blob of text""" 607 """Used for blob of text"""
608 type = 'text' 608 type = 'text'
609 609
610 def __init__(self, xmlui, value, name=None, parent=None): 610 def __init__(self, xmlui, value, name=None, parent=None):
611 super(TextWidget, self).__init__(xmlui, name, parent) 611 super(TextWidget, self).__init__(xmlui, name, parent)
612 value_elt = self.xmlui.doc.createElement('value')
612 text = self.xmlui.doc.createTextNode(value) 613 text = self.xmlui.doc.createTextNode(value)
613 self.elem.appendChild(text) 614 value_elt.appendChild(text)
615 self.elem.appendChild(value_elt)
614 616
615 617
616 class LabelWidget(Widget): 618 class LabelWidget(Widget):
617 """Used for one line blob of text, 619 """Used for one line blob of text,
618 most of time to display the desciption or name of the next widget 620 most of time to display the desciption or name of the next widget
673 type = 'string' 675 type = 'string'
674 676
675 def __init__(self, xmlui, value=None, name=None, parent=None, read_only=False): 677 def __init__(self, xmlui, value=None, name=None, parent=None, read_only=False):
676 super(StringWidget, self).__init__(xmlui, name, parent, read_only=read_only) 678 super(StringWidget, self).__init__(xmlui, name, parent, read_only=read_only)
677 if value: 679 if value:
678 self.elem.setAttribute('value', value) 680 value_elt = self.xmlui.doc.createElement('value')
681 text = self.xmlui.doc.createTextNode(value)
682 value_elt.appendChild(text)
683 self.elem.appendChild(value_elt)
679 684
680 685
681 class PasswordWidget(StringWidget): 686 class PasswordWidget(StringWidget):
682 type = 'password' 687 type = 'password'
683 688