def beginDrag(self, event): global insertion insertion = 'fail' lview = event.GetEventObject() """ Begin a Drag Operation """ # Create DataObject to holds text to be dragged index = lview.GetFirstSelected() id = int(lview.GetItemText(index)) title = lview.GetItem(index, 1).GetText() source = lview.GetName() data = '%s:%s:%s' % (str(id), str(title), source) tdo = wx.PyTextDataObject(data) # Create a DropSourceObject, for Drag operation tds = wx.DropSource(lview) # Associate the Data to be dragged with the Drop Source Object tds.SetData(tdo) # Intiate the Drag Operation tds.DoDragDrop(True) # if drop was successful remove item from source if insertion == 'ok': lview.DeleteItem(index) lv.decorateBanding(lview)
def OnDropText(self, x, y, data): global insertion lview = self.obj data = str(data).split(':') source = data[2] lview.SetFocus() destination = lview.Name if source != destination: """ Implement Text Drop """ # When text is dropped, write it into the object specified index = lview.Append(data[0] + '\n\n') lview.SetStringItem(index, 1, data[1]) insertion = 'ok' ##rint' insertion = 0k' lv.decorateBanding(lview)
def moveSelectedFromAtoB(self, lvSource, lvDestination): selection = lv.GetSelectedItems(lvSource) if not selection: return # copy selected items to new listview for index in selection: id = lvSource.GetItemText(index) title = lvSource.GetItem(index, 1).GetText() indexD = lvDestination.Append(str(id)) lvDestination.SetStringItem(indexD, 0, str(id)) lvDestination.SetStringItem(indexD, 1, title) # finaly remove the selected items in reverse order selection = fetch.reverseList(selection) for index in selection: lvSource.DeleteItem(index) lv.decorateBanding(lvSource) lv.decorateBanding(lvDestination)
def banding(self): #rint'DlgExculActivityListEditor > banding' lv.decorateBanding(self.list_ctrl_excul) self.vlist_ctrl_activity_pool.decorateBanding() self.vlist_ctrl_teacher_pool.decorateBanding()
def banding(self): #rint'DlgExculRoster > banding' lv.decorateBanding(self.list_ctrl_excul) self.vlist_ctrl_student_pool.decorateBanding() self.vlist_ctrl_teacher_pool.decorateBanding()