]>
Commit | Line | Data |
---|---|---|
e395c057 RD |
1 | |
2 | import sys, os | |
3 | from wxPython.wx import * | |
4 | from wxPython.lib.mvctree import * | |
5 | ||
6 | ||
7 | logger = None | |
8 | def selchanging(evt): | |
9 | logger.write("SelChanging!\n") | |
10 | ||
11 | def selchanged(evt): | |
12 | logger.write("SelChange!\n") | |
13 | logger.write(str(evt.node)) | |
14 | def expanded(evt): | |
15 | logger.write("Expanded\n") | |
16 | def closed(evt): | |
17 | logger.write("Closed!\n") | |
18 | def key(evt): | |
19 | logger.write("Key\n") | |
20 | def add(evt): | |
21 | logger.write("Add\n") | |
22 | def delitem(evt): | |
23 | logger.write("Delete\n") | |
24 | ||
25 | def runTest(frame, nb, log): | |
26 | #f = wxFrame(frame, -1, "wxMVCTree", wxPoint(0,0), wxSize(200,500)) | |
27 | global logger | |
28 | logger = log | |
29 | p = wxMVCTree(nb, -1) | |
30 | p.SetAssumeChildren(true) | |
31 | p.SetModel(LateFSTreeModel(os.path.normpath(os.getcwd() + os.sep +'..'))) | |
32 | #Uncomment this to enable live filename editing! | |
33 | # p.AddEditor(FileEditor(p)) | |
34 | p.SetMultiSelect(true) | |
35 | EVT_MVCTREE_SEL_CHANGING(p, p.GetId(), selchanging) | |
36 | EVT_MVCTREE_SEL_CHANGED(p, p.GetId(), selchanged) | |
37 | EVT_MVCTREE_ITEM_EXPANDED(p, p.GetId(), expanded) | |
38 | EVT_MVCTREE_ITEM_COLLAPSED(p, p.GetId(), closed) | |
39 | EVT_MVCTREE_ADD_ITEM(p, p.GetId(), add) | |
40 | EVT_MVCTREE_DELETE_ITEM(p, p.GetId(), delitem) | |
41 | EVT_MVCTREE_KEY_DOWN(p, p.GetId(), key) | |
42 | return p | |
43 | ||
44 | overview = """\ | |
45 | wxMVCTree is a control which handles hierarchical data. It is constructed in model-view-controller architecture, so the display of that data, and the content of the data can be changed greatly without affecting the other parts. | |
46 | ||
47 | Multiple selections are possible by holding down the Ctrl key. | |
48 | ||
49 | This demo shows the wxPython directory structure. The interesting part is that the tree model is late-bound to the filesystem, so the filenames are not retrieved until the directory is expanded. In mvctree.py are models for generic data, and both the early and late-bound filesystem models. | |
50 | ||
51 | There is also support for editing, though it's not enabled in this demo, to avoid accidentally renaming files! | |
52 | ||
53 | """ | |
54 | ||
55 | ||
56 | ||
57 | ||
58 | ||
59 | ||
60 | ||
61 |