CodeFileTreeNode.py
changeset 1448 20ff66dcc31d
parent 1332 ac7d39f4e376
child 1511 91538d0c242c
equal deleted inserted replaced
1447:d6b878525ceb 1448:20ff66dcc31d
    29                         <xsd:enumeration value="output"/>
    29                         <xsd:enumeration value="output"/>
    30                       </xsd:restriction>
    30                       </xsd:restriction>
    31                     </xsd:simpleType>
    31                     </xsd:simpleType>
    32                   </xsd:attribute>
    32                   </xsd:attribute>
    33                   <xsd:attribute name="initial" type="xsd:string" use="optional" default=""/>
    33                   <xsd:attribute name="initial" type="xsd:string" use="optional" default=""/>
       
    34                   <xsd:attribute name="desc" type="xsd:string" use="optional" default=""/>
       
    35                   <xsd:attribute name="onchange" type="xsd:string" use="optional" default=""/>
       
    36                   <xsd:attribute name="opts" type="xsd:string" use="optional" default=""/>
    34                 </xsd:complexType>
    37                 </xsd:complexType>
    35               </xsd:element>
    38               </xsd:element>
    36             </xsd:sequence>
    39             </xsd:sequence>
    37           </xsd:complexType>
    40           </xsd:complexType>
    38         </xsd:element>
    41         </xsd:element>
   117         for var in variables:
   120         for var in variables:
   118             variable = self.CodeFileParser.CreateElement("variable", "variables")
   121             variable = self.CodeFileParser.CreateElement("variable", "variables")
   119             variable.setname(var["Name"])
   122             variable.setname(var["Name"])
   120             variable.settype(var["Type"])
   123             variable.settype(var["Type"])
   121             variable.setinitial(var["Initial"])
   124             variable.setinitial(var["Initial"])
       
   125             variable.setdesc(var["Description"])
       
   126             variable.setonchange(var["OnChange"])
       
   127             variable.setopts(var["Options"])
   122             self.CodeFile.variables.appendvariable(variable)
   128             self.CodeFile.variables.appendvariable(variable)
   123     
   129     
   124     def GetVariables(self):
   130     def GetVariables(self):
   125         datas = []
   131         datas = []
   126         for var in self.CodeFileVariables(self.CodeFile):
   132         for var in self.CodeFileVariables(self.CodeFile):
   127             datas.append({"Name" : var.getname(), 
   133             datas.append({"Name" : var.getname(), 
   128                           "Type" : var.gettype(), 
   134                           "Type" : var.gettype(), 
   129                           "Initial" : var.getinitial()})
   135                           "Initial" : var.getinitial(),
       
   136                           "Description" : var.getdesc(),
       
   137                           "OnChange"    : var.getonchange(),
       
   138                           "Options"     : var.getopts(),
       
   139                          })
   130         return datas
   140         return datas
   131 
   141 
   132     def SetTextParts(self, parts):
   142     def SetTextParts(self, parts):
   133         for section in self.SECTIONS_NAMES:
   143         for section in self.SECTIONS_NAMES:
   134             section_code = parts.get(section)
   144             section_code = parts.get(section)
   155         
   165         
   156         self.MarkCodeFileAsSaved()
   166         self.MarkCodeFileAsSaved()
   157         return True
   167         return True
   158 
   168 
   159     def CTNGlobalInstances(self):
   169     def CTNGlobalInstances(self):
   160         current_location = self.GetCurrentLocation()
   170         variables = self.CodeFileVariables(self.CodeFile)
   161         return [(variable.getname(),
   171         ret =  [(variable.getname(),
   162                  variable.gettype(),
   172                  variable.gettype(),
   163                  variable.getinitial())
   173                  variable.getinitial()) 
   164                 for variable in self.CodeFileVariables(self.CodeFile)]
   174                 for variable in variables]
       
   175         ret.extend([("On"+variable.getname()+"Change", "python_poll", "")
       
   176                 for variable in variables
       
   177                 if variable.getonchange()])
       
   178         return ret
   165 
   179 
   166 #-------------------------------------------------------------------------------
   180 #-------------------------------------------------------------------------------
   167 #                      Current Buffering Management Functions
   181 #                      Current Buffering Management Functions
   168 #-------------------------------------------------------------------------------
   182 #-------------------------------------------------------------------------------
   169 
   183