diff 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
line wrap: on
line diff
--- a/src/tools/xml_tools.py	Wed Jun 25 14:01:56 2014 +0200
+++ b/src/tools/xml_tools.py	Wed Jun 25 14:01:57 2014 +0200
@@ -609,8 +609,10 @@
 
     def __init__(self, xmlui, value, name=None, parent=None):
         super(TextWidget, self).__init__(xmlui, name, parent)
+        value_elt = self.xmlui.doc.createElement('value')
         text = self.xmlui.doc.createTextNode(value)
-        self.elem.appendChild(text)
+        value_elt.appendChild(text)
+        self.elem.appendChild(value_elt)
 
 
 class LabelWidget(Widget):
@@ -675,7 +677,10 @@
     def __init__(self, xmlui, value=None, name=None, parent=None, read_only=False):
         super(StringWidget, self).__init__(xmlui, name, parent, read_only=read_only)
         if value:
-            self.elem.setAttribute('value', value)
+            value_elt = self.xmlui.doc.createElement('value')
+            text = self.xmlui.doc.createTextNode(value)
+            value_elt.appendChild(text)
+            self.elem.appendChild(value_elt)
 
 
 class PasswordWidget(StringWidget):