X-Git-Url: https://git.saurik.com/wxWidgets.git/blobdiff_plain/299647acac7960652aadb008775429c1f8ea9b8d..864a91c827740da5e8a3e1f36feaf396d34dedc0:/wxPython/demo/Grid_MegaExample.py diff --git a/wxPython/demo/Grid_MegaExample.py b/wxPython/demo/Grid_MegaExample.py index 751e7ab291..4eafd68ab2 100644 --- a/wxPython/demo/Grid_MegaExample.py +++ b/wxPython/demo/Grid_MegaExample.py @@ -1,7 +1,3 @@ -# 11/18/2003 - Jeff Grimmett (grimmtooth@softhome.net) -# -# o Updated for wx namespace -# import wx import wx.grid as Grid @@ -10,7 +6,7 @@ import images class MegaTable(Grid.PyGridTableBase): """ - A custom wxGrid Table using user supplied data + A custom wx.Grid Table using user supplied data """ def __init__(self, data, colnames, plugins): """data is a list of the form @@ -90,7 +86,7 @@ class MegaTable(Grid.PyGridTableBase): def _updateColAttrs(self, grid): """ - wxGrid -> update the column attributes to add the + wx.Grid -> update the column attributes to add the appropriate renderer given the column name. (renderers are stored in the self.plugins dictionary) @@ -187,7 +183,7 @@ class MegaTable(Grid.PyGridTableBase): # -------------------------------------------------------------------- -# Sample wxGrid renderers +# Sample wx.Grid renderers class MegaImageRenderer(Grid.PyGridCellRenderer): def __init__(self, table): @@ -223,7 +219,6 @@ class MegaImageRenderer(Grid.PyGridCellRenderer): dc.SetPen(wx.Pen(wx.WHITE, 1, wx.SOLID)) dc.DrawRectangleRect(rect) - #dc.DrawRectangle((rect.x, rect.y), (rect.width, rect.height)) # copy the image but only to the size of the grid cell width, height = bmp.GetWidth(), bmp.GetHeight() @@ -234,9 +229,9 @@ class MegaImageRenderer(Grid.PyGridCellRenderer): if height > rect.height-2: height = rect.height-2 - dc.Blit((rect.x+1, rect.y+1), (width, height), + dc.Blit(rect.x+1, rect.y+1, width, height, image, - (0, 0), wx.COPY, True) + 0, 0, wx.COPY, True) class MegaFontRenderer(Grid.PyGridCellRenderer): @@ -269,8 +264,6 @@ class MegaFontRenderer(Grid.PyGridCellRenderer): dc.SetPen(wx.Pen(wx.WHITE, 1, wx.SOLID)) dc.DrawRectangleRect(rect) - #dc.DrawRectangle((rect.x, rect.y), (rect.width, rect.height)) - text = self.table.GetValue(row, col) dc.SetBackgroundMode(wx.SOLID) @@ -285,7 +278,7 @@ class MegaFontRenderer(Grid.PyGridCellRenderer): dc.SetTextForeground(self.color) dc.SetFont(self.font) - dc.DrawText(text, (rect.x+1, rect.y+1)) + dc.DrawText(text, rect.x+1, rect.y+1) # Okay, now for the advanced class :) # Let's add three dots "..." @@ -297,8 +290,8 @@ class MegaFontRenderer(Grid.PyGridCellRenderer): if width > rect.width-2: width, height = dc.GetTextExtent("...") x = rect.x+1 + rect.width-2 - width - dc.DrawRectangle((x, rect.y+1), (width+1, height)) - dc.DrawText("...", (x, rect.y+1)) + dc.DrawRectangle(x, rect.y+1, width+1, height) + dc.DrawText("...", x, rect.y+1) dc.DestroyClippingRegion() @@ -483,5 +476,5 @@ behavior and various hacks. if __name__ == '__main__': import sys,os import run - run.main(['', os.path.basename(sys.argv[0])]) + run.main(['', os.path.basename(sys.argv[0])] + sys.argv[1:])