def displayData(self, exculset_id): self.exculset_id = exculset_id res = fetch.exculsetinfo(exculset_id) if res: school, day, semester, schYr = res else: #rint'DlgExcul fai' return flag_insertion, self.replaceName, self.replace_id = '' , '', 0 txt = "Excul activities for exculset id:%d > %s > %s, \ Semester %d, %d" % (self.exculset_id, school, day, semester, schYr) self.SetTitle(txt) self.exculList = fetch.excul_groups_forExculSet(self.exculset_id) lv.populateWithList(self.list_ctrl_excul, self.exculList) otherActivities = fetch.excul_activityPool(self.exculList) self.activityPoolDATA = fetch.build_dictionary(otherActivities) self.vlist_ctrl_activity_pool.SetItemMap(self.activityPoolDATA) otherTeachers = fetch.excul_teacherPool(self.exculList) self.teacherPoolDATA = fetch.build_dictionary(otherTeachers) self.vlist_ctrl_teacher_pool.SetItemMap(self.teacherPoolDATA)
def listActivities(self, day): list_ctrl = self.list_ctrl_list[day-1] res = fetch.excul_groups_forSchSemYr(day, gVar.semester, gVar.school_id) newlist = [] for row in res: newlist.append((row[0], row[2], row[4])) res = tuple(newlist) list_ctrl.SetItemMap(fetch.build_dictionary(res))
def OnBeginDragTeacher(self, event): index = self.vlist_ctrl_teacher_pool.GetFirstSelected() if index < 0: return employee_id = int(self.vlist_ctrl_teacher_pool.GetItemText(index)) title = self.vlist_ctrl_teacher_pool.GetItem(index, 1).GetText() source = self.vlist_ctrl_teacher_pool.GetName() data = '%s:%s:%s' % (str(employee_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.newTeacherList(employee_id) if flag_insertion == 'replaced': new_list.append((g_replace_teacher_id, fetch.employeeName(g_replace_teacher_id))) self.teacherPoolDATA = fetch.build_dictionary(new_list) self.vlist_ctrl_teacher_pool.SetItemMap(self.teacherPoolDATA)
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()