2003-12-08 20:23:28 -05:00
|
|
|
# 11/18/2003 - Jeff Grimmett (grimmtooth@softhome.net)
|
|
|
|
#
|
|
|
|
# o Updated for wx namespace
|
|
|
|
#
|
2000-07-15 15:51:35 -04:00
|
|
|
|
2003-12-08 20:23:28 -05:00
|
|
|
import wx
|
2000-07-15 15:51:35 -04:00
|
|
|
|
|
|
|
#---------------------------------------------------------------------------
|
|
|
|
|
|
|
|
buttonDefs = {
|
2003-03-25 01:35:27 -05:00
|
|
|
814 : ('GridSimple', ' Simple wxGrid, catching all events '),
|
|
|
|
815 : ('GridStdEdRend', ' wxGrid showing Editors and Renderers '),
|
|
|
|
818 : ('GridHugeTable', ' A wxGrid with a HUGE table (100 MILLION cells!) '),
|
|
|
|
817 : ('GridCustTable', ' wxGrid using a custom Table, with non-string data '),
|
|
|
|
819 : ('GridEnterHandler',' Remapping keys to behave differently '),
|
|
|
|
820 : ('GridCustEditor', ' Shows how to create a custom Cell Editor '),
|
|
|
|
821 : ('GridDragable', ' A wxGrid with dragable rows and columns '),
|
2003-12-08 20:23:28 -05:00
|
|
|
822 : ('GridDragAndDrop', ' Shows how to make a grid a drop target for files'),
|
2000-07-15 15:51:35 -04:00
|
|
|
}
|
|
|
|
|
|
|
|
|
2003-12-08 20:23:28 -05:00
|
|
|
class ButtonPanel(wx.Panel):
|
2000-07-15 15:51:35 -04:00
|
|
|
def __init__(self, parent, log):
|
2003-12-08 20:23:28 -05:00
|
|
|
wx.Panel.__init__(self, parent, -1)
|
2000-07-15 15:51:35 -04:00
|
|
|
self.log = log
|
|
|
|
|
2003-12-11 14:55:48 -05:00
|
|
|
box = wx.BoxSizer(wx.VERTICAL)
|
2003-11-21 02:36:53 -05:00
|
|
|
box.Add((20, 20))
|
2000-07-15 15:51:35 -04:00
|
|
|
keys = buttonDefs.keys()
|
|
|
|
keys.sort()
|
2003-12-08 20:23:28 -05:00
|
|
|
|
2000-07-15 15:51:35 -04:00
|
|
|
for k in keys:
|
|
|
|
text = buttonDefs[k][1]
|
2003-12-08 20:23:28 -05:00
|
|
|
btn = wx.Button(self, k, text)
|
|
|
|
box.Add(btn, 0, wx.ALIGN_CENTER|wx.ALL, 10)
|
|
|
|
self.Bind(wx.EVT_BUTTON, self.OnButton, btn)
|
2000-07-15 15:51:35 -04:00
|
|
|
|
2003-03-25 01:35:27 -05:00
|
|
|
self.SetAutoLayout(True)
|
2000-07-15 15:51:35 -04:00
|
|
|
self.SetSizer(box)
|
|
|
|
|
|
|
|
|
|
|
|
def OnButton(self, evt):
|
|
|
|
modName = buttonDefs[evt.GetId()][0]
|
|
|
|
module = __import__(modName)
|
2000-11-04 02:38:17 -05:00
|
|
|
frame = module.TestFrame(None, self.log)
|
2003-03-25 01:35:27 -05:00
|
|
|
frame.Show(True)
|
2000-07-15 15:51:35 -04:00
|
|
|
|
|
|
|
|
|
|
|
#---------------------------------------------------------------------------
|
|
|
|
|
|
|
|
def runTest(frame, nb, log):
|
|
|
|
win = ButtonPanel(nb, log)
|
|
|
|
return win
|
|
|
|
|
|
|
|
#---------------------------------------------------------------------------
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
overview = """\
|
|
|
|
<html><body>
|
|
|
|
<h2>wxGrid</h2>
|
|
|
|
|
|
|
|
This demo shows various ways of using the <b><i>new and
|
|
|
|
improved</i></b> wxGrid class. Unfortunatly it has not been
|
|
|
|
documented yet, and while it is somewhat backwards compatible, if you
|
|
|
|
try to go by the current wxGrid documentation you will probably just
|
|
|
|
confuse yourself.
|
|
|
|
<p>
|
|
|
|
You can look at the sources for these samples to learn a lot about how
|
|
|
|
the new classes work.
|
|
|
|
<p><ol>
|
|
|
|
<li><a href="GridSimple.py">GridSimple.py</a> A simple grid that shows
|
|
|
|
how to catch all the various events.
|
|
|
|
|
|
|
|
<p>
|
|
|
|
<li><a href="GridStdEdRend.py">GridStdEdRend.py</a> A grid that
|
|
|
|
uses non-default Cell Editors and Cell Renderers.
|
|
|
|
|
|
|
|
<p>
|
|
|
|
<li><a href="GridHugeTable.py">GridHugeTable.py</a> A grid that
|
|
|
|
uses a non-default Grid Table. This table is read-only and simply
|
|
|
|
generates on the fly a unique string for each cell.
|
|
|
|
|
|
|
|
<p>
|
|
|
|
<li><a href="GridCustTable.py">GridCustTable.py</a> This grid
|
|
|
|
shows how to deal with tables that have non-string data, and how Cell
|
|
|
|
Editors and Cell Renderers are automatically chosen based on the data
|
|
|
|
type.
|
|
|
|
|
|
|
|
<p>
|
|
|
|
<li><a href="GridEnterHandler.py">GridEnterHandler.py</a>This one
|
|
|
|
changes how the ENTER key works, moving the current cell left to right
|
|
|
|
and wrapping around to the next row when needed.
|
|
|
|
</ol>
|
|
|
|
<p>
|
|
|
|
|
|
|
|
"""
|
|
|
|
|
2002-08-24 17:44:02 -04:00
|
|
|
|
|
|
|
if __name__ == '__main__':
|
|
|
|
import sys,os
|
|
|
|
import run
|
|
|
|
run.main(['', os.path.basename(sys.argv[0])])
|
|
|
|
|