]> git.saurik.com Git - wxWidgets.git/blobdiff - wxPython/demo/GridStdEdRend.py
WinCE patches from "Viktor Voroshylo" <viktor@voroshylo.com>
[wxWidgets.git] / wxPython / demo / GridStdEdRend.py
index 5ad7c752d54b29aac124b9b08d4321540e1e8f6e..e5e144b84aaad01786a21fdebcd24ecbea3d8016 100644 (file)
@@ -1,7 +1,7 @@
 from wxPython.wx import *
 from wxPython.grid import *
 
-import string, random
+import random
 
 #---------------------------------------------------------------------------
 
@@ -13,18 +13,18 @@ class MyCustomRenderer(wxPyGridCellRenderer):
         dc.SetBackgroundMode(wxSOLID)
         dc.SetBrush(wxBrush(wxBLACK, wxSOLID))
         dc.SetPen(wxTRANSPARENT_PEN)
-        dc.DrawRectangle(rect.x, rect.y, rect.width, rect.height)
+        dc.DrawRectangleRect(rect)
 
         dc.SetBackgroundMode(wxTRANSPARENT)
         dc.SetFont(attr.GetFont())
 
         text = grid.GetCellValue(row, col)
-        colors = [wxRED, wxWHITE, wxCYAN]
+        colors = ["RED", "WHITE", "SKY BLUE"]
         x = rect.x + 1
         y = rect.y + 1
         for ch in text:
             dc.SetTextForeground(random.choice(colors))
-            dc.DrawText(ch, x, y)
+            dc.DrawText(ch, (x, y))
             w, h = dc.GetTextExtent(ch)
             x = x + w
             if x > rect.right - 5:
@@ -60,7 +60,7 @@ editorDemoData = [
     ('wxGridCellBoolEditor', '1', wxGridCellBoolEditor, ()),
     ('wxGridCellChoiceEditor', 'one', wxGridCellChoiceEditor, (['one', 'two', 'three', 'four',
                                                          'kick', 'Microsoft', 'out the',
-                                                         'door'], false)),
+                                                         'door'], False)),
     ]
 
 
@@ -107,7 +107,7 @@ Renderers used together.
 
         row = 2
         for label, value, renderClass, args in rendererDemoData:
-            renderer = apply(renderClass, args)
+            renderer = renderClass(*args)
             self.SetCellValue(row, renCol, label)
             self.SetCellValue(row, renCol+1, value)
             self.SetCellRenderer(row, renCol+1, renderer)
@@ -116,7 +116,7 @@ Renderers used together.
 
         row = 2
         for label, value, editorClass, args in editorDemoData:
-            editor = apply(editorClass, args)
+            editor = editorClass(*args)
             self.SetCellValue(row, edCol, label)
             self.SetCellValue(row, edCol+1, value)
             self.SetCellEditor(row, edCol+1, editor)
@@ -127,8 +127,8 @@ Renderers used together.
         for label, value, renClass, edClass in comboDemoData:
             self.SetCellValue(row, renCol, label)
             self.SetCellValue(row, renCol+1, value)
-            editor = apply(edClass, ()) #args)
-            renderer = apply(renClass, ()) #args)
+            editor = edClass()
+            renderer = renClass()
             self.SetCellEditor(row, renCol+1, editor)
             self.SetCellRenderer(row, renCol+1, renderer)
             row = row + 2
@@ -139,16 +139,15 @@ Renderers used together.
         attr = wxGridCellAttr()
         attr.SetFont(font)
         attr.SetBackgroundColour(wxLIGHT_GREY)
-        attr.SetReadOnly(true)
+        attr.SetReadOnly(True)
         attr.SetAlignment(wxRIGHT, -1)
         self.SetColAttr(renCol, attr)
         attr.IncRef()
         self.SetColAttr(edCol, attr)
 
         # There is a bug in wxGTK for this method...
-        if wxPlatform != '__WXGTK__':
-            self.AutoSizeColumns(true)
-        self.AutoSizeRows(true)
+        self.AutoSizeColumns(True)
+        self.AutoSizeRows(True)
 
         EVT_GRID_CELL_LEFT_DCLICK(self, self.OnLeftDClick)
 
@@ -175,7 +174,7 @@ if __name__ == '__main__':
     import sys
     app = wxPySimpleApp()
     frame = TestFrame(None, sys.stdout)
-    frame.Show(true)
+    frame.Show(True)
     app.MainLoop()