CodeFileTreeNode.py
changeset 1448 20ff66dcc31d
parent 1332 ac7d39f4e376
child 1511 91538d0c242c
--- a/CodeFileTreeNode.py	Tue Feb 17 10:23:57 2015 +0100
+++ b/CodeFileTreeNode.py	Thu Feb 19 00:40:53 2015 +0100
@@ -31,6 +31,9 @@
                     </xsd:simpleType>
                   </xsd:attribute>
                   <xsd:attribute name="initial" type="xsd:string" use="optional" default=""/>
+                  <xsd:attribute name="desc" type="xsd:string" use="optional" default=""/>
+                  <xsd:attribute name="onchange" type="xsd:string" use="optional" default=""/>
+                  <xsd:attribute name="opts" type="xsd:string" use="optional" default=""/>
                 </xsd:complexType>
               </xsd:element>
             </xsd:sequence>
@@ -119,6 +122,9 @@
             variable.setname(var["Name"])
             variable.settype(var["Type"])
             variable.setinitial(var["Initial"])
+            variable.setdesc(var["Description"])
+            variable.setonchange(var["OnChange"])
+            variable.setopts(var["Options"])
             self.CodeFile.variables.appendvariable(variable)
     
     def GetVariables(self):
@@ -126,7 +132,11 @@
         for var in self.CodeFileVariables(self.CodeFile):
             datas.append({"Name" : var.getname(), 
                           "Type" : var.gettype(), 
-                          "Initial" : var.getinitial()})
+                          "Initial" : var.getinitial(),
+                          "Description" : var.getdesc(),
+                          "OnChange"    : var.getonchange(),
+                          "Options"     : var.getopts(),
+                         })
         return datas
 
     def SetTextParts(self, parts):
@@ -157,11 +167,15 @@
         return True
 
     def CTNGlobalInstances(self):
-        current_location = self.GetCurrentLocation()
-        return [(variable.getname(),
+        variables = self.CodeFileVariables(self.CodeFile)
+        ret =  [(variable.getname(),
                  variable.gettype(),
-                 variable.getinitial())
-                for variable in self.CodeFileVariables(self.CodeFile)]
+                 variable.getinitial()) 
+                for variable in variables]
+        ret.extend([("On"+variable.getname()+"Change", "python_poll", "")
+                for variable in variables
+                if variable.getonchange()])
+        return ret
 
 #-------------------------------------------------------------------------------
 #                      Current Buffering Management Functions