controls/CustomTable.py
branchwxPython4
changeset 3303 0ffb41625592
parent 1881 091005ec69c4
child 3750 f62625418bff
equal deleted inserted replaced
3302:c89fc366bebd 3303:0ffb41625592
    38     """
    38     """
    39     A custom wx.grid.Grid Table using user supplied data
    39     A custom wx.grid.Grid Table using user supplied data
    40     """
    40     """
    41     def __init__(self, parent, data, colnames):
    41     def __init__(self, parent, data, colnames):
    42         # The base class must be initialized *first*
    42         # The base class must be initialized *first*
    43         wx.grid.PyGridTableBase.__init__(self)
    43         wx.grid.GridTableBase.__init__(self)
    44         self.data = data
    44         self.data = data
    45         self.colnames = colnames
    45         self.colnames = colnames
    46         self.Highlights = {}
    46         self.Highlights = {}
    47         self.Parent = parent
    47         self.Parent = parent
    48         # XXX
    48         # XXX
    62             if translate:
    62             if translate:
    63                 return _(self.colnames[col])
    63                 return _(self.colnames[col])
    64             return self.colnames[col]
    64             return self.colnames[col]
    65 
    65 
    66     def GetRowLabelValue(self, row, translate=True):
    66     def GetRowLabelValue(self, row, translate=True):
    67         return row
    67         return str(row)
    68 
    68 
    69     def GetValue(self, row, col):
    69     def GetValue(self, row, col):
    70         if row < self.GetNumberRows():
    70         if row < self.GetNumberRows():
    71             return self.data[row].get(self.GetColLabelValue(col, False), "")
    71             return self.data[row].get(self.GetColLabelValue(col, False), "")
    72 
    72