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 |