24 def __init__(self, parent, ID, pos=wx.DefaultPosition,
25 size=wx.DefaultSize, style=0):
26 wx.ListCtrl.__init__(self, parent, ID, pos, size, style)
38 (
"Component Type" ,
""),
39 (
"Activity Type",
""),
46 (
"OutPort Attr.",
""),
50 wx.Panel.__init__(self, parent, -1, style=wx.WANTS_CHARS)
52 self.
il = wx.ImageList(16, 16)
61 wx.LC_REPORT | wx.SUNKEN_BORDER
62 | wx.LC_VRULES | wx.LC_HRULES)
64 self.
list.SetImageList(self.
il, wx.IMAGE_LIST_SMALL)
66 info.m_mask = wx.LIST_MASK_TEXT | wx.LIST_MASK_IMAGE | wx.LIST_MASK_WIDTH | wx.LIST_MASK_FORMAT
67 info.m_text =
"Attribute" 70 info.m_format = wx.LIST_FORMAT_LEFT
71 self.
list.InsertColumnInfo(0, info)
75 self.
list.InsertColumnInfo(1, info)
78 self.Bind(wx.EVT_SIZE, self.
OnSize)
85 if attr ==
"Instance ID":
87 elif attr==
"InPort Attr.":
88 self.
list.InsertImageStringItem(x, attr, self.
inp_bmp)
89 elif attr==
"OutPort Attr.":
93 self.
list.SetStringItem(x, 1, val)
95 if attr ==
"InPort Attr.":
97 self.
list.SetItemBackgroundColour(x,
98 wx.Color(0xdd, 0xdd, 0xdd))
99 elif attr ==
"OutPort Attr.":
100 print "OutPort Attr." 101 self.
list.SetItemBackgroundColour(x,
102 wx.Color(0xdd, 0xdd, 0xdd))
106 self.
list.SetItemState(5, wx.LIST_STATE_SELECTED,
107 wx.LIST_STATE_SELECTED)
114 (
"Instance ID", profile.instance_name),
115 (
"Impl. ID", profile.type_name),
116 (
"Maker", profile.vendor),
117 (
"Description", profile.description),
118 (
"Version", profile.version),
119 (
"Category", profile.category)
141 self.
list.DeleteAllItems()
145 w,h = self.GetClientSizeTuple()
146 self.
list.SetDimensions(0, 0, w, h)
158 This example demonstrates the ListCtrl's Virtual List features. A Virtual list 159 can contain any number of cells, but data is not loaded into the control itself. 160 It is loaded on demand via virtual methods <code>OnGetItemText(), OnGetItemImage()</code>, 161 and <code>OnGetItemAttr()</code>. This greatly reduces the amount of memory required 162 without limiting what can be done with the list control itself. 167 if __name__ ==
'__main__':
170 run.main([
'', os.path.basename(sys.argv[0])] + sys.argv[1:])
def runTest(frame, nb, log)
def __init__(self, parent, ID, pos=wx.DefaultPosition, size=wx.DefaultSize, style=0)
def __init__(self, parent)
def RefreshProfile(self, profile)