197 |
197 |
198 Otherwise default to the default renderer. |
198 Otherwise default to the default renderer. |
199 """ |
199 """ |
200 for row in range(self.GetNumberRows()): |
200 for row in range(self.GetNumberRows()): |
201 var_class = self.GetValueByName(row, "Class") |
201 var_class = self.GetValueByName(row, "Class") |
|
202 var_type = self.GetValueByName(row, "Type") |
202 for col in range(self.GetNumberCols()): |
203 for col in range(self.GetNumberCols()): |
203 editor = None |
204 editor = None |
204 renderer = None |
205 renderer = None |
205 colname = self.GetColLabelValue(col, False) |
206 colname = self.GetColLabelValue(col, False) |
206 if colname == "Option": |
207 if colname == "Option": |
220 else: |
221 else: |
221 editor = wx.grid.GridCellTextEditor() |
222 editor = wx.grid.GridCellTextEditor() |
222 renderer = wx.grid.GridCellStringRenderer() |
223 renderer = wx.grid.GridCellStringRenderer() |
223 elif colname == "Initial Value": |
224 elif colname == "Initial Value": |
224 if var_class != "External": |
225 if var_class != "External": |
225 editor = wx.grid.GridCellTextEditor() |
226 if self.Parent.Controler.IsEnumeratedType(var_type): |
|
227 editor = wx.grid.GridCellChoiceEditor() |
|
228 editor.SetParameters(",".join(self.Parent.Controler.GetEnumeratedDataValues(var_type))) |
|
229 else: |
|
230 editor = wx.grid.GridCellTextEditor() |
226 renderer = wx.grid.GridCellStringRenderer() |
231 renderer = wx.grid.GridCellStringRenderer() |
227 else: |
232 else: |
228 grid.SetReadOnly(row, col, True) |
233 grid.SetReadOnly(row, col, True) |
229 elif colname == "Location": |
234 elif colname == "Location": |
230 if var_class in ["Local", "Global"]: |
235 if var_class in ["Local", "Global"] and self.Parent.Controler.IsLocatableType(var_type): |
231 editor = LocationCellEditor(self, self.Parent.Controler) |
236 editor = LocationCellEditor(self, self.Parent.Controler) |
232 renderer = wx.grid.GridCellStringRenderer() |
237 renderer = wx.grid.GridCellStringRenderer() |
233 else: |
238 else: |
234 grid.SetReadOnly(row, col, True) |
239 grid.SetReadOnly(row, col, True) |
235 elif colname == "Class": |
240 elif colname == "Class": |
238 else: |
243 else: |
239 editor = wx.grid.GridCellChoiceEditor() |
244 editor = wx.grid.GridCellChoiceEditor() |
240 excluded = [] |
245 excluded = [] |
241 if self.Parent.PouIsUsed: |
246 if self.Parent.PouIsUsed: |
242 excluded.extend(["Input","Output","InOut"]) |
247 excluded.extend(["Input","Output","InOut"]) |
243 if self.Parent.IsFunctionBlockType(self.data[row]["Type"]): |
248 if self.Parent.IsFunctionBlockType(var_type): |
244 excluded.extend(["Local","Temp"]) |
249 excluded.extend(["Local","Temp"]) |
245 editor.SetParameters(",".join([_(choice) for choice in self.Parent.ClassList if choice not in excluded])) |
250 editor.SetParameters(",".join([_(choice) for choice in self.Parent.ClassList if choice not in excluded])) |
246 elif colname != "Documentation": |
251 elif colname != "Documentation": |
247 grid.SetReadOnly(row, col, True) |
252 grid.SetReadOnly(row, col, True) |
248 |
253 |