diff frontends/src/tools/xmlui.py @ 1220:f91e7028e2c3

memory (params), tools (xml_tools), plugins, frontends: add "int" parameter type with "min" and "max" attributes
author souliane <souliane@mailoo.org>
date Fri, 03 Oct 2014 12:27:43 +0200
parents 0a448c947038
children e3a9ea76de35
line wrap: on
line diff
--- a/frontends/src/tools/xmlui.py	Mon Sep 22 22:25:44 2014 +0200
+++ b/frontends/src/tools/xmlui.py	Fri Oct 03 12:27:43 2014 +0200
@@ -101,6 +101,10 @@
     """
 
 
+class IntWidget(Widget):
+    """Input widget with require an integer"""
+
+
 class ButtonWidget(Widget):
     """A clickable widget"""
 
@@ -388,6 +392,9 @@
                 elif type_=="bool":
                     ctrl = self.widget_factory.createBoolWidget(_xmlui_parent, value==C.BOOL_TRUE, self._isAttrSet("read_only", node))
                     self.ctrl_list[name] = ({'type':type_, 'control':ctrl})
+                elif type_ == "int":
+                    ctrl = self.widget_factory.createIntWidget(_xmlui_parent, value, self._isAttrSet("read_only", node))
+                    self.ctrl_list[name] = ({'type':type_, 'control':ctrl})
                 elif type_ == "list":
                     style = [] if node.getAttribute("multi") == 'yes' else ['single']
                     _options = [(option.getAttribute("value"), option.getAttribute("label")) for option in node.getElementsByTagName("option")]