diff frontends/src/primitivus/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 6184779544c7
children e3a9ea76de35
line wrap: on
line diff
--- a/frontends/src/primitivus/xmlui.py	Mon Sep 22 22:25:44 2014 +0200
+++ b/frontends/src/primitivus/xmlui.py	Fri Oct 03 12:27:43 2014 +0200
@@ -155,6 +155,24 @@
         return "true" if self.get_state() else "false"
 
 
+class PrimitivusIntWidget(xmlui.IntWidget, sat_widgets.AdvancedEdit, PrimitivusEvents):
+
+    def __init__(self, _xmlui_parent, value, read_only=False):
+        sat_widgets.AdvancedEdit.__init__(self, edit_text=value)
+        self.read_only = read_only
+
+    def selectable(self):
+        if self.read_only:
+            return False
+        return super(PrimitivusIntWidget, self).selectable()
+
+    def _xmluiSetValue(self, value):
+        self.set_edit_text(value)
+
+    def _xmluiGetValue(self):
+        return self.get_edit_text()
+
+
 class PrimitivusButtonWidget(xmlui.ButtonWidget, sat_widgets.CustomButton, PrimitivusEvents):
 
     def __init__(self, _xmlui_parent, value, click_callback):