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 createAndLoad_listCtrls_forEachActivity(self): self.panel_list_ctrls.DestroyChildren() self.sizer_excul.Clear() self.exculList = fetch.excul_groups_forExculSet(self.exculset_id) if self.exculList: exculCount = len(self.exculList) r, c = round(exculCount/4), exculCount%4 self.sizer_excul.SetCols(c) self.sizer_excul.SetRows(r) itemNo = 0 for excul in self.exculList: excul_id = excul[0] #rint'create list_ctrl for excul_id', excul_id exculLV = self.createListCtrl(excul_id, itemNo) self.Bind(wx.EVT_CONTEXT_MENU, self.OnPopup, exculLV) #self.Bind(wx.EVT_MOUSE_EVENTS, self.OnPopup, exculLV) itemNo += 1 self.Layout()
def loadStudentPool(self): school_id = fetch.schoolID_forExculSet(self.exculset_id) return self.exculList = fetch.excul_groups_forExculSet(self.exculset_id) exculID_list = ','.join([str(x[0]) for x in self.exculList]) sql = "SELECT student_id FROM excul_students WHERE FIND_IN_SET(excul_id , '%s') " % exculID_list res = fetch.getAll_col(sql) in_excul_list = ','.join([str(x[0]) for x in res]) sql ="SELECT s.id, s.first_name, b.name \ FROM students s \ LEFT JOIN nis n ON s.id = n.student_id \ JOIN batch_students bs ON s.id = bs.student_id \ JOIN batches b ON b.id = bs.batch_id \ WHERE %d BETWEEN n.admission_year AND n.withdrew_year\ AND n.school_id = %d \ AND NOT FIND_IN_SET(s.id, '%s') \ GROUP BY s.id \ ORDER BY s.id \ LIMIT 90" % (gVar.schYr, school_id, in_excul_list) lv.populate(self.list_ctrl_pool, sql)