示例#1
0
    def createLV(self, excul_id, itemNo):
        # create a list view for each activity
        # and place it into the grid-bag-sizer
        r, c = round(itemNo/4), itemNo%4

        wxID = 1000 + int(excul_id)
        nameLV = 'list_ctrl_%d' % itemNo
        
        myLV = wx.ListView(id=wxID, name=nameLV, parent=self.scrolledPanel,
              pos=wx.Point(0, 0), size=wx.Size(154, 225),
              style=wx.LC_SINGLE_SEL | wx.LC_REPORT)
          
        title = fetch.activityTitle(excul_id) 
        #rint'nameLV', nameLV, 'activityTitle', title
        
        myLV.Bind(wx.EVT_LIST_BEGIN_DRAG, self.beginDrag,id=wxID)        
        self.scrolledPanelSizer.AddWindow(myLV, (r, c), border=10, flag=wx.EXPAND | wx.ALL, span=(1, 1))  

        dt1 = TextDropTarget(myLV) # Make this control a Drop Target
        myLV.SetDropTarget(dt1)         # Link to Control
        
        myLV.InsertColumn(col=0, format=wx.LIST_FORMAT_LEFT, heading = 'id',width=0)
        myLV.InsertColumn(col=1, format=wx.LIST_FORMAT_LEFT, heading = title,width=150)
        
        return myLV
示例#2
0
文件: lv.py 项目: ckSchool/bucky
def populateActivities(list_ctrl, activityIDs):
    list_ctrl.DeleteAllItems()
    if not activityIDs:
        return

    for activity_id in activityIDs:

        index = list_ctrl.Append(str(activity_id))
        # rint 'index ', index
        list_ctrl.SetStringItem(index, 0, str(activity_id))
        title = fetch.activityTitle(activity_id)
        # rint activity_id, " : title " , title
        list_ctrl.SetStringItem(index, 1, title)

    decorateBanding(list_ctrl)
    list_ctrl.Select(0)