def ResizeRow(self, grid, row): if grid.GetRowSize(row) < ROW_HEIGHT: grid.SetRowMinimalHeight(row, ROW_HEIGHT) grid.AutoSizeRow(row, False)
def _updateColAttrs(self, grid): """ wx.grid.Grid -> update the column attributes to add the appropriate renderer given the column name. Otherwise default to the default renderer. """ for col in range(self.GetNumberCols()): attr = wx.grid.GridCellAttr() attr.SetAlignment(ColAlignements[col], wx.ALIGN_CENTRE) grid.SetColAttr(col, attr) grid.SetColMinimalWidth(col, ColSizes[col]) grid.AutoSizeColumn(col, False) typelist = None maplist = None for row in range(self.GetNumberRows()): editors = self.editors[row] if wx.Platform == '__WXMSW__': grid.SetRowMinimalHeight(row, 20) else: grid.SetRowMinimalHeight(row, 28) grid.AutoSizeRow(row, False) for col in range(self.GetNumberCols()): editor = None renderer = None colname = self.GetColLabelValue(col, False) editortype = editors[colname] if editortype == "dcf": editor = wx.grid.GridCellTextEditor() renderer = wx.grid.GridCellStringRenderer() elif editortype and self.Editable: grid.SetReadOnly(row, col, False) if editortype == "string": editor = wx.grid.GridCellTextEditor() renderer = wx.grid.GridCellStringRenderer() if colname == "value" and "length" in editors: editor.SetParameters(editors["length"]) elif editortype == "number": editor = wx.grid.GridCellNumberEditor() renderer = wx.grid.GridCellNumberRenderer() if colname == "value" and "min" in editors and "max" in editors: editor.SetParameters("%s,%s"%(editors["min"],editors["max"])) elif editortype == "float": editor = wx.grid.GridCellTextEditor() renderer = wx.grid.GridCellStringRenderer() elif editortype == "bool": editor = wx.grid.GridCellBoolEditor() # editor.SetParameters(BoolList) elif editortype == "access": editor = wx.grid.GridCellChoiceEditor(AccessList, False) # editor.SetParameters(AccessList) elif editortype == "raccess": editor = wx.grid.GridCellChoiceEditor(RAccessList, False) # editor.SetParameters(RAccessList) elif editortype == "option": editor = wx.grid.GridCellChoiceEditor(OptionList, False) # editor.SetParameters(OptionList) elif editortype == "type": if typelist == None: typelist = self.Parent.Manager.GetCurrentTypeList() editor = wx.grid.GridCellChoiceEditor(typelist.split(",")) # editor.SetParameters(typelist) elif editortype == "map": if maplist == None: maplist = self.Parent.Manager.GetCurrentMapList() editor = wx.grid.GridCellChoiceEditor(maplist.split(",")) # editor.SetParameters(maplist) elif editortype == "time": editor = wx.grid.GridCellTextEditor() renderer = wx.grid.GridCellStringRenderer() elif editortype == "domain": editor = wx.grid.GridCellTextEditor() renderer = wx.grid.GridCellStringRenderer() else: grid.SetReadOnly(row, col, True) grid.SetCellEditor(row, col, editor) grid.SetCellRenderer(row, col, renderer) grid.SetCellBackgroundColour(row, col, wx.WHITE)
def ResizeRow(self, grid, row): if wx.Platform == '__WXMSW__': grid.SetRowMinimalHeight(row, 20) else: grid.SetRowMinimalHeight(row, 28) grid.AutoSizeRow(row, False)