controls/CustomTable.py
changeset 1342 c17507a10807
parent 814 5743cbdff669
child 1571 486f94a8032c
equal deleted inserted replaced
1341:0923e602c603 1342:c17507a10807
    15 #License along with this library; if not, write to the Free Software
    15 #License along with this library; if not, write to the Free Software
    16 #Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
    16 #Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
    17 
    17 
    18 import wx
    18 import wx
    19 import wx.grid
    19 import wx.grid
       
    20 
       
    21 if wx.Platform == '__WXMSW__':
       
    22     ROW_HEIGHT = 20
       
    23 else:
       
    24     ROW_HEIGHT = 28
    20 
    25 
    21 class CustomTable(wx.grid.PyGridTableBase):
    26 class CustomTable(wx.grid.PyGridTableBase):
    22     
    27     
    23     """
    28     """
    24     A custom wx.grid.Grid Table using user supplied data
    29     A custom wx.grid.Grid Table using user supplied data
   122                 grid.SetCellBackgroundColour(row, col, highlight_colours[0])
   127                 grid.SetCellBackgroundColour(row, col, highlight_colours[0])
   123                 grid.SetCellTextColour(row, col, highlight_colours[1])
   128                 grid.SetCellTextColour(row, col, highlight_colours[1])
   124             self.ResizeRow(grid, row)
   129             self.ResizeRow(grid, row)
   125     
   130     
   126     def ResizeRow(self, grid, row):
   131     def ResizeRow(self, grid, row):
   127         if wx.Platform == '__WXMSW__':
   132         if grid.GetRowSize(row) < ROW_HEIGHT:
   128             grid.SetRowMinimalHeight(row, 20)
   133             grid.SetRowMinimalHeight(row, ROW_HEIGHT)
   129         else:
   134             grid.AutoSizeRow(row, False)
   130             grid.SetRowMinimalHeight(row, 28)
       
   131         grid.AutoSizeRow(row, False)
       
   132     
   135     
   133     def SetData(self, data):
   136     def SetData(self, data):
   134         self.data = data
   137         self.data = data
   135     
   138     
   136     def GetData(self):
   139     def GetData(self):