1
2
3
4 """
5 A slightly modified version of the filling widget from wx.py.
6 """
7
8 import wx
9 import wx.py.filling as filling
10
11 import types
12
13
15 """
16 Show the content of a given namespace and mkes it possible to
17 filter out some elmements.
18 """
19
20 - def __init__(self,parent, id=-1, pos=wx.DefaultPosition,
21 size=wx.DefaultSize, style=wx.TR_DEFAULT_STYLE,
22 rootObject=None, rootLabel=None, rootIsNamespace=False,
23 static=False, show_private=False,expand_root=True):
24 """
25 Create the filling tree wit the same options as wx.py.FillingTree
26
27 If show_private is False then do not show private (begining
28 with '__') elements of the namespaces.
29 """
30
31 filling.FillingTree.__init__(self, parent, id, pos, size,
32 style, rootObject, "Apparatus", rootIsNamespace, static)
33 self.show_private = show_private
34 if expand_root:
35 self.Expand(self.root)
36
38 self.DeleteChildren(item)
39 obj = self.GetPyData(item)
40 children = self.objGetChildren(obj)
41 if not children:
42 return
43 keys = children.keys()
44 keys.sort(lambda x, y: cmp(str(x).lower(), str(y).lower()))
45 for key in keys:
46 itemtext = str(key)
47 if not self.show_private and itemtext.startswith('__'):
48 continue
49
50
51
52 if type(obj) is types.DictType \
53 and type(key) is types.StringType \
54 and (item != self.root \
55 or (item == self.root and not self.rootIsNamespace)):
56 itemtext = repr(key)
57 child = children[key]
58 data = wx.TreeItemData(child)
59 branch = self.AppendItem(parent=item, text=itemtext, data=data)
60 self.SetItemHasChildren(branch, self.objHasChildren(child))
61
63 """Launch a DirFrame."""
64 item = event.GetItem()
65 text = self.getFullName(item)
66 obj = self.GetPyData(item)
67 frame = filling.FillingFrame(parent=self, size=(600, 600), rootObject=obj,
68 rootLabel=text, rootIsNamespace=False)
69 frame.Show()
70
71
72 - def setText(self,txt):
73 """
74 Do nothing !
75 """
76 pass
77