def _updateColAttrs(self, grid):
"""
wx.Grid -> update the column attributes to add the
appropriate renderer given the column name.
Otherwise default to the default renderer.
"""
for row in range(self.GetNumberRows()):
for col in range(self.GetNumberCols()):
editor = None
renderer = None
readonly = False
colname = self.GetColLabelValue(col, False)
if colname == "Qualifier":
editor = wx.grid.GridCellChoiceEditor()
editor.SetParameters(self.Parent.QualifierList)
if colname == "Duration":
editor = wx.grid.GridCellTextEditor()
renderer = wx.grid.GridCellStringRenderer()
readonly = not self.Parent.DurationList[self.data[row].qualifier]
elif colname == "Type":
editor = wx.grid.GridCellChoiceEditor()
editor.SetParameters(self.Parent.TypeList)
elif colname == "Value":
value_type = self.data[row].type
if value_type == "Action":
editor = wx.grid.GridCellChoiceEditor()
editor.SetParameters(self.Parent.ActionList)
elif value_type == "Variable":
editor = wx.grid.GridCellChoiceEditor()
editor.SetParameters(self.Parent.VariableList)
elif value_type == "Inline":
editor = wx.grid.GridCellTextEditor()
renderer = wx.grid.GridCellStringRenderer()
elif colname == "Indicator":
editor = wx.grid.GridCellChoiceEditor()
editor.SetParameters(self.Parent.VariableList)
grid.SetCellEditor(row, col, editor)
grid.SetCellRenderer(row, col, renderer)
grid.SetReadOnly(row, col, readonly)
grid.SetCellBackgroundColour(row, col, wx.WHITE)
self.ResizeRow(grid, row)
# -------------------------------------------------------------------------------
# Action Block Dialog
# -------------------------------------------------------------------------------
评论列表
文章目录