Exemplo n.º 1
0
    def SearchALL(self):

        top = tk.Toplevel()
        top.title('Input')
        Input = WindowRemove('Search: ', top)
        Input.mainloop()
        top.destroy()

        searchString = Input.getvar(str(Input.Input1))

        top = tk.Toplevel()
        top.title('Serch Results')
        top.text = Listbox(top)
        top.text.grid(row=0, column=0)
        top.text.config(width=50)

        top.text.insert(END, 'Disciplines:')
        for discipline in self._disciplineControl.getCurentRepo(
        ).getDisciplines():
            if searchString.lower() in str(discipline.getId()).lower() or str(
                    discipline.getId()).lower() in searchString.lower(
                    ) or searchString.lower() in discipline.getName().lower(
                    ) or discipline.getName().lower() in searchString.lower():
                top.text.insert(END, discipline)

        top.text.insert(END, 'Students:')
        for student in self._studentControl.getCurentRepo().getStudents():
            if searchString.lower() in str(student.getId()).lower() or str(
                    student.getId()).lower() in searchString.lower(
                    ) or searchString.lower() in student.getName().lower(
                    ) or student.getName().lower() in searchString.lower():
                top.text.insert(END, student)
Exemplo n.º 2
0
 def search(self, searchString):
     '''
     Function to search in the student list
     :param: searchString - string to be searched for
     '''
     for student in self._students:
         if searchString.lower() in str(student.getId()).lower() or str(
                 student.getId()).lower() in searchString.lower(
                 ) or searchString.lower() in student.getName().lower(
                 ) or student.getName().lower() in searchString.lower():
             print student
Exemplo n.º 3
0
    def BestStudents(self):

        top = tk.Toplevel()
        top.title('Enrollment List')
        top.text = Listbox(top)
        top.text.grid(row=0, column=0)
        top.text.config(width=50)

        sList = [['', '']]
        gList = []
        sName = ''
        for student in self._studentControl.getCurentRepo().getStudents():
            for grade in self._gradeControl.getCurentRepo().getGrades():
                if student.getId() == grade.getStudentID():
                    if (grade.getGrade() != []):
                        gAvg = self.listAvg(grade.getGrade(),
                                            grade.getGradeSize())
                        gList.append(gAvg)
                        sName = student.getName()
            if gList != []:
                sAvg = self.listAvg(gList, len(gList))
                sList.append([sName, round(sAvg, 2)])

        sList.sort(key=itemgetter(1), reverse=True)
        for index in range(1, len(sList)):
            top.text.insert(
                END, str(sList[index][0] + ' - ' + str(sList[index][1])))
        del sList[:]
Exemplo n.º 4
0
    def FailingStudents(self):

        top = tk.Toplevel()
        top.title('Enrollment List')
        top.text = Listbox(top)
        top.text.grid(row=0, column=0)
        top.text.config(width=50)

        sList = [['', '']]
        for grade in self._gradeControl.getCurentRepo().getGrades():
            for student in self._studentControl.getCurentRepo().getStudents():
                for discipline in self._disciplineControl.getCurentRepo(
                ).getDisciplines():
                    if grade.getStudentID() == student.getId():
                        if grade.getDisciplineID() == discipline.getId():
                            if grade.getGrade() != []:
                                gradeAvg = self.listAvg(
                                    grade.getGrade(), grade.getGradeSize())
                                if gradeAvg < 5:
                                    sList.append([
                                        student.getName(),
                                        discipline.getName()
                                    ])

        for index in sList:
            top.text.insert(END, '\n' + index[0] + ' - ' + index[1])
        del sList[:]
Exemplo n.º 5
0
    def StudentEnrollB(self):

        try:
            top = tk.Toplevel()
            top.title('Enrollment List')
            top.text = Listbox(top)
            top.text.grid(row=0, column=0)

            index = self.dList.curselection()
            disciplineID = self.DreadID(self.dList.get(index))
            disciplineID = int(disciplineID)

            SList = [[' ', -1]]
            for grade in self._gradeControl.getCurentRepo().getGrades():
                if grade.getDisciplineID() == disciplineID:
                    for student in self._studentControl.getCurentRepo(
                    ).getStudents():
                        if student.getId() == grade.getStudentID():
                            if grade.getGrade() != []:
                                gradeAvg = self.listAvg(
                                    grade.getGrade(), grade.getGradeSize())
                                SList.append([student.getName(), gradeAvg])

            SList.sort(key=itemgetter(1), reverse=True)
            del SList[-1]
            for index in SList:
                top.text.insert(END, index)
            del SList[:]

        except TclError:
            top.destroy()
            self.displayError('No disicpline Selected')
Exemplo n.º 6
0
 def searchStudent(self, studentID):
     '''
     Function to find a student in the list
     :param: studentID - student to be found
     '''
     for student in self.getStudents():
         if student.getId() == studentID:
             return student
     raise classException('Student not found!')
Exemplo n.º 7
0
 def addStudent(self, student):
     '''
     Function to add a student to the student list
     :param: student - student to be added
     '''
     try:
         self.searchStudent(student.getId())
         raise ValueError('Student ID already taken')
     except classException:
         return self._students.append(student)
Exemplo n.º 8
0
 def updateStudentName(self, studentID, newName):
     '''
     Function to update a student name
     :param: studentID - the student ID to be updated
     :param: newName - the new name
     '''
     for student in self.getStudents():
         if student.getId() == studentID:
             student.setName(newName)
             return
     raise classException('ID not found!')
Exemplo n.º 9
0
 def removeStudent(self, studentID):
     '''
     Function to remove a student from the list
     :param: studentID - student to be removed
     '''
     for index in range(len(self._students)):
         student = self._students[index]
         if student.getId() == studentID:
             del self._students[index]
             return
     raise classException('ID not found!')
Exemplo n.º 10
0
 def statEnroll(self):
     disciplineID =int(input('\nEnter discipline ID:'))
     print '\n1). Sort alphabetically'
     print '2). Sort by grade'
     option = input('Enter Option:')
     if option != 1 and option != 2:
         print 'Option invalid'
         return
     
     elif option == 1:
         sList = []
         for enroll in self._enrolControl.getCurentRepo().getEnroll():
             if enroll.get_discipline_id() == disciplineID:
                 sList.append(enroll.get_student_id())
         
         for index in range(len(sList)):
             for student in self._studentControl.getCurentRepo().getStudents():
                 if sList[index] == student.getId():
                     sList[index] = student.getName()
         
         sList.sort()
         print '\n' 
         for index in sList:
             print index
         del sList[:]
     
     elif option == 2:
         sList = [[' ',-1]]
         for grade in self._gradeControl.getCurentRepo().getGrades():
             if grade.getDisciplineID() == disciplineID:
                 for student in self._studentControl.getCurentRepo().getStudents():
                     if student.getId() == grade.getStudentID():
                         if grade.getGrade() != []:
                             gradeAvg = self.listAvg(grade.getGrade(),grade.getGradeSize())
                             sList.append([student.getName(),gradeAvg])
         
         sList.sort(key=itemgetter(1),reverse = True)
         print '\n'
         for index in range(len(sList)-1):
             print sList[index]
         del sList[:]
Exemplo n.º 11
0
 def updateStudentID(self, studentID, newID):
     '''
     Function to update a student ID
     :param: studentID - the student ID to be updated
     :param: newID - the new ID
     '''
     try:
         self.searchStudent(newID)
         raise ValueError('Student ID already taken')
     except classException:
         for student in self.getStudents():
             if student.getId() == studentID:
                 student.setId(newID)
                 return
         raise classException('ID not found!')
Exemplo n.º 12
0
 def statFailing(self):
     sList = [['','']]
     for grade in self._gradeControl.getCurentRepo().getGrades():
         for student in self._studentControl.getCurentRepo().getStudents():
             for discipline in self._disciplineControl.getCurentRepo().getDisciplines():
                 if grade.getStudentID() == student.getId():
                     if grade.getDisciplineID() == discipline.getId():
                         if grade.getGrade() != []:
                             gradeAvg = self.listAvg(grade.getGrade(),grade.getGradeSize())
                             if gradeAvg < 5:
                                 sList.append([student.getName(),discipline.getName()])
     
     print '\n'
     for index in sList:
         print index[0],' - ',index[1]
     del sList[:]
Exemplo n.º 13
0
 def statBest(self):
     sList =[['','']]
     gList =[]
     sName = ''
     for student in self._studentControl.getCurentRepo().getStudents():
         for grade in self._gradeControl.getCurentRepo().getGrades():
             if student.getId() == grade.getStudentID():
                 if(grade.getGrade() != []):
                     gAvg = self.listAvg(grade.getGrade(), grade.getGradeSize())
                     gList.append(gAvg)
                     sName = student.getName()
         if gList != []:
             sAvg = self.listAvg(gList, len(gList))
             sList.append([sName,round(sAvg,2)])
     
     sList.sort(key=itemgetter(1),reverse = True)
     print '\n'
     for index in range(1,len(sList)):
         print sList[index][0],' - ',sList[index][1]
     del sList[:]