diff src/tools/xml_tools.py @ 865:3ee2ec7ec010

core (xmlui), frontends: handling of "text" type in params xml + bug fixes
author Goffi <goffi@goffi.org>
date Tue, 25 Feb 2014 23:01:26 +0100
parents 97ee7594c788
children 65bf1bc70f6b
line wrap: on
line diff
--- a/src/tools/xml_tools.py	Tue Feb 25 10:59:05 2014 +0100
+++ b/src/tools/xml_tools.py	Tue Feb 25 23:01:26 2014 +0100
@@ -199,10 +199,10 @@
 
             param_name = param.getAttribute('name')
             param_label = param.getAttribute('label')
-            if not param_name:
+            type_ = param.getAttribute('type')
+            if not param_name and type_ != 'text':
                 raise exceptions.DataError(_('INTERNAL ERROR: params must have a name'))
 
-            type_ = param.getAttribute('type')
             value = param.getAttribute('value') or None
             callback_id = param.getAttribute('callback_id') or None
 
@@ -210,7 +210,7 @@
                 options = _getParamListOptions(param)
                 widget_kwargs['options'] = options
 
-            if type_ == "button":
+            if type_ in ("button", "text"):
                 param_ui.addEmpty()
                 value = param_label
             else:
@@ -513,9 +513,9 @@
 class TextWidget(Widget):
     type = 'text'
 
-    def __init__(self, xmlui, text, name=None, parent=None):
+    def __init__(self, xmlui, value, name=None, parent=None):
         super(TextWidget, self).__init__(xmlui, name, parent)
-        text = self.xmlui.doc.createTextNode(text)
+        text = self.xmlui.doc.createTextNode(value)
         self.elem.appendChild(text)