]>
git.saurik.com Git - wxWidgets.git/blob - wxPython/demo/wxMVCTree.py
3 from wxPython
.wx
import *
4 from wxPython
.lib
.mvctree
import *
9 logger
.write("SelChanging!\n")
12 logger
.write("SelChange!\n")
13 logger
.write(str(evt
.node
))
15 logger
.write("Expanded\n")
17 logger
.write("Closed!\n")
23 logger
.write("Delete\n")
25 def runTest(frame
, nb
, log
):
26 #f = wxFrame(frame, -1, "wxMVCTree", wxPoint(0,0), wxSize(200,500))
30 #f = wxFrame(frame, -1, "wxMVCTree")
32 p
.SetAssumeChildren(True)
33 p
.SetModel(LateFSTreeModel(os
.path
.normpath(os
.getcwd() + os
.sep
+'..')))
34 #Uncomment this to enable live filename editing!
35 # p.AddEditor(FileEditor(p))
36 p
.SetMultiSelect(True)
37 EVT_MVCTREE_SEL_CHANGING(p
, p
.GetId(), selchanging
)
38 EVT_MVCTREE_SEL_CHANGED(p
, p
.GetId(), selchanged
)
39 EVT_MVCTREE_ITEM_EXPANDED(p
, p
.GetId(), expanded
)
40 EVT_MVCTREE_ITEM_COLLAPSED(p
, p
.GetId(), closed
)
41 EVT_MVCTREE_ADD_ITEM(p
, p
.GetId(), add
)
42 EVT_MVCTREE_DELETE_ITEM(p
, p
.GetId(), delitem
)
43 EVT_MVCTREE_KEY_DOWN(p
, p
.GetId(), key
)
55 wxMVCTree is a control which handles hierarchical data. It is
56 constructed in model-view-controller architecture, so the display of
57 that data, and the content of the data can be changed greatly without
58 affecting the other parts.
60 Multiple selections are possible by holding down the Ctrl key.
62 This demo shows the wxPython directory structure. The interesting part
63 is that the tree model is late-bound to the filesystem, so the
64 filenames are not retrieved until the directory is expanded. In
65 mvctree.py are models for generic data, and both the early and
66 late-bound filesystem models.
68 There is also support for editing, though it's not enabled in this
69 demo, to avoid accidentally renaming files!
77 if __name__
== '__main__':
80 run
.main(['', os
.path
.basename(sys
.argv
[0])])