Bug wrong control state while refreshing interface fixed
authorlaurent
Fri, 04 Sep 2009 11:24:25 +0200
changeset 389 bde723abfdfc
parent 388 9d5b3d63563d
child 390 44909ffb2cc6
child 392 6617d3fb43e2
Bug wrong control state while refreshing interface fixed
plugins/python/modules/svgui/svguilib.py
--- a/plugins/python/modules/svgui/svguilib.py	Thu Sep 03 12:09:39 2009 +0200
+++ b/plugins/python/modules/svgui/svguilib.py	Fri Sep 04 11:24:25 2009 +0200
@@ -8,10 +8,13 @@
         self.sele_elt = getSVGElementById(args.sele_id)
         self.toggle = args.toggle
         self.active = args.active
-        self.state = False
+        if args.state != undefined:
+            self.state = args.state
+        else:
+            self.state = False
         self.dragging = False
-        if toggle:
-            self.up = not state
+        if self.toggle:
+            self.up = not self.state
         else:
             self.up = True
         
@@ -45,6 +48,7 @@
         if values.state != self.state:
             self.state = values.state
             self.up = not self.state
+            updateAttr(self.id, 'state', self.state)
             self.updateElements()
 
     def handleEvent(self, evt):
@@ -86,23 +90,27 @@
                     updateAttr(self.id, 'state', self.state)
                     self.updateElements()
                 self.dragging = False
-        
+
 class textControl:
     
     def __init__(self, parent, id, args):
         self.parent = parent
         self.id = id
         self.back_elt = getSVGElementById(args.back_id)
-        self.value = ""
+        if args.text != undefined:
+            self.text = args.text
+        else:
+            self.text = ""
         self.updateElements()
     
     def updateValues(self, values):
         if values.text != self.value:
-            self.value = values.text
+            self.text = values.text
+            updateAttr(self.id, 'text', self.text)
             self.updateElements()
     
     def updateElements(self):
-        self.back_elt.firstChild.firstChild.textContent = self.value
+        self.back_elt.firstChild.firstChild.textContent = self.text
     
     def handleEvent(self, evt):
         pass