def OnBeginDragActivity(self, event): index = self.vlist_ctrl_activity_pool.GetFirstSelected() if index < 0: return activity_id = int(self.vlist_ctrl_activity_pool.GetItemText(index)) title = self.vlist_ctrl_activity_pool.GetItem(index, 1).GetText() source = self.vlist_ctrl_activity_pool.GetName() data = '%s:%s:%s' % (str(activity_id), str(title), source) """ Begin a Drag Operation """ todrop = wx.PyTextDataObject(data) drop_source = wx.DropSource(self.list_ctrl_excul) # Create a DropSourceObject, for Drag operation drop_source.SetData(todrop) # Associate the Data to be dragged with the Drop Source Object drop_source.DoDragDrop(True) # Intiate the Drag Operation new_list = self.newActivityList(activity_id) if flag_insertion == 'replaced': new_list.append((g_replace_activity_id, fetch.excul_activityTitle(g_replace_activity_id))) self.activityPoolDATA = fetch.build_dictionary(new_list) self.vlist_ctrl_activity_pool.SetItemMap(self.activityPoolDATA)
def OnActivities_Dclick(self, event): selection = self.vlist_ctrl_activity_pool.GetIds_ofSelectedItems() if not selection: return # convert tuple to list exculList = list(self.exculList) for activity_id in selection: activity_title = fetch.excul_activityTitle(activity_id) self.list_ctrl_excul.Append((0, activity_id, activity_title, 0, '' )) new_list = [] for row in self.activityPoolDATA: res = self.activityPoolDATA[row] item_id = res[0] if not item_id == activity_id: new_list.append(res) self.activityPoolDATA = fetch.build_dictionary(new_list) self.vlist_ctrl_activity_pool.SetItemMap(self.activityPoolDATA) self.banding()
def addToActivityPool(self, activity_id): self.activityPoolDATA[len(self.activityPoolDATA)] = (int(activity_id), fetch.excul_activityTitle(activity_id)) self.vlist_ctrl_activity_pool.SetItemMap(self.activityPoolDATA)