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)
def update_DisciplineName(self): try: top = tk.Toplevel() top.title('Input') Input = WindowRemove('New name', top) Input.mainloop() top.destroy() index = self.dList.curselection() disciplineID = self.DreadID(self.dList.get(index)) disciplineID = int(disciplineID) oldName = self.dList.get(index)[self.dList.get(index).index('|') + 8:-2] if not Input.getvar(str(Input.Input1)) == None: newName = Input.getvar(str(Input.Input1)) Valid().name(newName) self._disciplineControl.getCurentRepo().updateDisciplineName( disciplineID, newName) self._disciplineControl.updateName(disciplineID, oldName, newName) self.refreshALL() except ValueError: self.displayError('Invalid Input') except NameError: self.displayError('Invalid Name') except TclError: self.displayError('No item selected')
def add_Grade(self): try: top = tk.Toplevel() top.title('Input') Input = WindowRemove('Grade: ', top) Input.mainloop() top.destroy() index = self.gList.curselection() IDs = self.EreadID(self.eList.get(index)) studentID = int(IDs[0]) disciplineID = int(IDs[1]) if not Input.getvar(str(Input.Input1)) == None: gradeValue = Input.getvar(str(Input.Input1)) gradeValue = float(gradeValue) Valid().grade(gradeValue) self._gradeControl.addGrade(grade(disciplineID, studentID), gradeValue) self._gradeControl.create(grade(disciplineID, studentID), gradeValue) self.refreshALL() except ValueError: self.displayError('Invalid Input') except NameError: self.displayError('Invalid Name') except TclError: self.displayError('No item selected')
def update_DisciplineID(self): try: top = tk.Toplevel() top.title('Input') Input = WindowRemove('New ID', top) Input.mainloop() top.destroy() index = self.dList.curselection() disciplineID = self.DreadID(self.dList.get(index)) disciplineID = int(disciplineID) if not Input.getvar(str(Input.Input1)) == None: newID = Input.getvar(str(Input.Input1)) newID = int(newID) self._disciplineControl.getCurentRepo().updateDisciplineID( disciplineID, newID) self._enrolControl.getCurentRepo().updateDisciplineID( disciplineID, newID) self._gradeControl.getCurentRepo().updateGradeDisciplineID( disciplineID, newID) self._disciplineControl.updateID(disciplineID, newID) self.refreshALL() except ValueError: self.displayError('Invalid Input') except NameError: self.displayError('Invalid Name') except TclError: self.displayError('No item selected')