]> git.saurik.com Git - wxWidgets.git/blobdiff - wxPython/demo/GridCustTable.py
better __docfilter__ and other epydoc tweaks
[wxWidgets.git] / wxPython / demo / GridCustTable.py
index cc151f9ac72fe584fe1e6020e466e4610d0b5c6c..8bfec553949d8e4e0a0737391b963cef3ca624ae 100644 (file)
@@ -1,28 +1,26 @@
-from wxPython.wx import *
-from wxPython.grid import *
 
 
-#---------------------------------------------------------------------------
+import  wx
+import  wx.grid as gridlib
 
 
-class CustomDataTable(wxPyGridTableBase):
-    """
-    """
+#---------------------------------------------------------------------------
 
 
+class CustomDataTable(gridlib.PyGridTableBase):
     def __init__(self, log):
     def __init__(self, log):
-        wxPyGridTableBase.__init__(self)
+        gridlib.PyGridTableBase.__init__(self)
         self.log = log
 
         self.colLabels = ['ID', 'Description', 'Severity', 'Priority', 'Platform',
                           'Opened?', 'Fixed?', 'Tested?', 'TestFloat']
 
         self.log = log
 
         self.colLabels = ['ID', 'Description', 'Severity', 'Priority', 'Platform',
                           'Opened?', 'Fixed?', 'Tested?', 'TestFloat']
 
-        self.dataTypes = [wxGRID_VALUE_NUMBER,
-                          wxGRID_VALUE_STRING,
-                          wxGRID_VALUE_CHOICE + ':only in a million years!,wish list,minor,normal,major,critical',
-                          wxGRID_VALUE_NUMBER + ':1,5',
-                          wxGRID_VALUE_CHOICE + ':all,MSW,GTK,other',
-                          wxGRID_VALUE_BOOL,
-                          wxGRID_VALUE_BOOL,
-                          wxGRID_VALUE_BOOL,
-                          wxGRID_VALUE_FLOAT + ':6,2',
+        self.dataTypes = [gridlib.GRID_VALUE_NUMBER,
+                          gridlib.GRID_VALUE_STRING,
+                          gridlib.GRID_VALUE_CHOICE + ':only in a million years!,wish list,minor,normal,major,critical',
+                          gridlib.GRID_VALUE_NUMBER + ':1,5',
+                          gridlib.GRID_VALUE_CHOICE + ':all,MSW,GTK,other',
+                          gridlib.GRID_VALUE_BOOL,
+                          gridlib.GRID_VALUE_BOOL,
+                          gridlib.GRID_VALUE_BOOL,
+                          gridlib.GRID_VALUE_FLOAT + ':6,2',
                           ]
 
         self.data = [
                           ]
 
         self.data = [
@@ -67,9 +65,10 @@ class CustomDataTable(wxPyGridTableBase):
             self.SetValue(row, col, value)
 
             # tell the grid we've added a row
             self.SetValue(row, col, value)
 
             # tell the grid we've added a row
-            msg = wxGridTableMessage(self,                             # The table
-                                     wxGRIDTABLE_NOTIFY_ROWS_APPENDED, # what we did to it
-                                     1)                                # how many
+            msg = gridlib.GridTableMessage(self,            # The table
+                    gridlib.GRIDTABLE_NOTIFY_ROWS_APPENDED, # what we did to it
+                    1                                       # how many
+                    )
 
             self.GetView().ProcessTableMessage(msg)
 
 
             self.GetView().ProcessTableMessage(msg)
 
@@ -108,9 +107,9 @@ class CustomDataTable(wxPyGridTableBase):
 
 
 
 
 
 
-class CustTableGrid(wxGrid):
+class CustTableGrid(gridlib.Grid):
     def __init__(self, parent, log):
     def __init__(self, parent, log):
-        wxGrid.__init__(self, parent, -1)
+        gridlib.Grid.__init__(self, parent, -1)
 
         table = CustomDataTable(log)
 
 
         table = CustomDataTable(log)
 
@@ -123,8 +122,7 @@ class CustTableGrid(wxGrid):
         self.SetMargins(0,0)
         self.AutoSizeColumns(False)
 
         self.SetMargins(0,0)
         self.AutoSizeColumns(False)
 
-        EVT_GRID_CELL_LEFT_DCLICK(self, self.OnLeftDClick)
-
+        gridlib.EVT_GRID_CELL_LEFT_DCLICK(self, self.OnLeftDClick)
 
 
     # I do this because I don't like the default behaviour of not starting the
 
 
     # I do this because I don't like the default behaviour of not starting the
@@ -136,17 +134,21 @@ class CustTableGrid(wxGrid):
 
 #---------------------------------------------------------------------------
 
 
 #---------------------------------------------------------------------------
 
-class TestFrame(wxFrame):
+class TestFrame(wx.Frame):
     def __init__(self, parent, log):
     def __init__(self, parent, log):
-        wxFrame.__init__(self, parent, -1, "Custom Table, data driven Grid  Demo", size=(640,480))
-        p = wxPanel(self, -1, style=0)
+
+        wx.Frame.__init__(
+            self, parent, -1, "Custom Table, data driven Grid  Demo", size=(640,480)
+            )
+
+        p = wx.Panel(self, -1, style=0)
         grid = CustTableGrid(p, log)
         grid = CustTableGrid(p, log)
-        b = wxButton(p, -1, "Another Control...")
+        b = wx.Button(p, -1, "Another Control...")
         b.SetDefault()
         b.SetDefault()
-        EVT_BUTTON(self, b.GetId(), self.OnButton)
-        EVT_SET_FOCUS(b, self.OnButtonFocus)
-        bs = wxBoxSizer(wxVERTICAL)
-        bs.Add(grid, 1, wxGROW|wxALL, 5)
+        self.Bind(wx.EVT_BUTTON, self.OnButton, b)
+        b.Bind(wx.EVT_SET_FOCUS, self.OnButtonFocus)
+        bs = wx.BoxSizer(wx.VERTICAL)
+        bs.Add(grid, 1, wx.GROW|wx.ALL, 5)
         bs.Add(b)
         p.SetSizer(bs)
 
         bs.Add(b)
         p.SetSizer(bs)
 
@@ -161,7 +163,7 @@ class TestFrame(wxFrame):
 
 if __name__ == '__main__':
     import sys
 
 if __name__ == '__main__':
     import sys
-    app = wxPySimpleApp()
+    app = wx.PySimpleApp()
     frame = TestFrame(None, sys.stdout)
     frame.Show(True)
     app.MainLoop()
     frame = TestFrame(None, sys.stdout)
     frame.Show(True)
     app.MainLoop()