]>
Commit | Line | Data |
---|---|---|
8fa876ca RD |
1 | # 11/18/2003 - Jeff Grimmett (grimmtooth@softhome.net) |
2 | # | |
3 | # o Updated for wx namespace | |
4 | # | |
f6bcfd97 | 5 | |
8fa876ca | 6 | import wx |
f6bcfd97 BP |
7 | |
8 | #--------------------------------------------------------------------------- | |
9 | ||
10 | buttonDefs = { | |
1e4a197e RD |
11 | 814 : ('GridSimple', ' Simple wxGrid, catching all events '), |
12 | 815 : ('GridStdEdRend', ' wxGrid showing Editors and Renderers '), | |
13 | 818 : ('GridHugeTable', ' A wxGrid with a HUGE table (100 MILLION cells!) '), | |
14 | 817 : ('GridCustTable', ' wxGrid using a custom Table, with non-string data '), | |
15 | 819 : ('GridEnterHandler',' Remapping keys to behave differently '), | |
16 | 820 : ('GridCustEditor', ' Shows how to create a custom Cell Editor '), | |
17 | 821 : ('GridDragable', ' A wxGrid with dragable rows and columns '), | |
8fa876ca | 18 | 822 : ('GridDragAndDrop', ' Shows how to make a grid a drop target for files'), |
f6bcfd97 BP |
19 | } |
20 | ||
21 | ||
8fa876ca | 22 | class ButtonPanel(wx.Panel): |
f6bcfd97 | 23 | def __init__(self, parent, log): |
8fa876ca | 24 | wx.Panel.__init__(self, parent, -1) |
f6bcfd97 BP |
25 | self.log = log |
26 | ||
372bde9b | 27 | box = wx.BoxSizer(wx.VERTICAL) |
fbd5dd1d | 28 | box.Add((20, 20)) |
f6bcfd97 BP |
29 | keys = buttonDefs.keys() |
30 | keys.sort() | |
8fa876ca | 31 | |
f6bcfd97 BP |
32 | for k in keys: |
33 | text = buttonDefs[k][1] | |
8fa876ca RD |
34 | btn = wx.Button(self, k, text) |
35 | box.Add(btn, 0, wx.ALIGN_CENTER|wx.ALL, 10) | |
36 | self.Bind(wx.EVT_BUTTON, self.OnButton, btn) | |
f6bcfd97 | 37 | |
1e4a197e | 38 | self.SetAutoLayout(True) |
f6bcfd97 BP |
39 | self.SetSizer(box) |
40 | ||
41 | ||
42 | def OnButton(self, evt): | |
43 | modName = buttonDefs[evt.GetId()][0] | |
44 | module = __import__(modName) | |
83625579 | 45 | frame = module.TestFrame(None, self.log) |
1e4a197e | 46 | frame.Show(True) |
f6bcfd97 BP |
47 | |
48 | ||
49 | #--------------------------------------------------------------------------- | |
50 | ||
51 | def runTest(frame, nb, log): | |
52 | win = ButtonPanel(nb, log) | |
53 | return win | |
54 | ||
55 | #--------------------------------------------------------------------------- | |
56 | ||
57 | ||
58 | ||
f6bcfd97 BP |
59 | overview = """\ |
60 | <html><body> | |
61 | <h2>wxGrid</h2> | |
62 | ||
63 | This demo shows various ways of using the <b><i>new and | |
64 | improved</i></b> wxGrid class. Unfortunatly it has not been | |
65 | documented yet, and while it is somewhat backwards compatible, if you | |
66 | try to go by the current wxGrid documentation you will probably just | |
67 | confuse yourself. | |
68 | <p> | |
69 | You can look at the sources for these samples to learn a lot about how | |
70 | the new classes work. | |
71 | <p><ol> | |
72 | <li><a href="GridSimple.py">GridSimple.py</a> A simple grid that shows | |
73 | how to catch all the various events. | |
74 | ||
75 | <p> | |
76 | <li><a href="GridStdEdRend.py">GridStdEdRend.py</a> A grid that | |
77 | uses non-default Cell Editors and Cell Renderers. | |
78 | ||
79 | <p> | |
80 | <li><a href="GridHugeTable.py">GridHugeTable.py</a> A grid that | |
81 | uses a non-default Grid Table. This table is read-only and simply | |
82 | generates on the fly a unique string for each cell. | |
83 | ||
84 | <p> | |
85 | <li><a href="GridCustTable.py">GridCustTable.py</a> This grid | |
86 | shows how to deal with tables that have non-string data, and how Cell | |
87 | Editors and Cell Renderers are automatically chosen based on the data | |
88 | type. | |
89 | ||
90 | <p> | |
91 | <li><a href="GridEnterHandler.py">GridEnterHandler.py</a>This one | |
92 | changes how the ENTER key works, moving the current cell left to right | |
93 | and wrapping around to the next row when needed. | |
94 | </ol> | |
95 | <p> | |
f6bcfd97 BP |
96 | |
97 | """ | |
98 | ||
f19533bf | 99 | |
f19533bf RD |
100 | if __name__ == '__main__': |
101 | import sys,os | |
102 | import run | |
103 | run.main(['', os.path.basename(sys.argv[0])]) | |
104 |