def guardarEstudiante(self):
        try:
            ced = self.get_cedula().get()
            nom = self.get_nombre().get()
            ape = self.get_apellido().get()
            dire = self.get_direccion().get()
            tel = self.get_telefono().get()
            cel = self.get_celular().get()
            email = self.get_email().get()

            if (self.validar_campos(nom, ape, dire, email)):  #cmapos cadena
                if (Util.validar_cedula(ced) and Util.validar_contacto(
                        tel, cel)):  #campos numericos
                    if (Util.verificar_estudiante(ced)):
                        messagebox.showinfo("Error",
                                            "Estudiante ya registrado!")
                    else:
                        self.contacto = Contacto(tel, cel, email)
                        bd.total_estudiantes.append(
                            Estudiante(
                                **{
                                    "cedula": ced,
                                    "nombre": nom,
                                    "apellido": ape,
                                    "direccion": dire,
                                    "contacto": self.contacto
                                }))
                        messagebox.showinfo("Correcto", "Datos Guardados")
                        #                        self.content.cargar_item((ced, nom, ape, dire))
                        self.limpiar_campos()

        except ValueError:
            messagebox.showinfo("Error", "Datos no validos")
Beispiel #2
0
    def buscar(self):
        """Permite tomar un Test de Ubicacion al alumno."""
        c = self.get_cedula().get()

        if ( c.isdigit() and Util.verificar_estudiante(int(c))):
            try:
                self.p = Util.get_posicion_in_list(c)
                self.alu = bd.total_estudiantes[self.p]

                if (self.alu.cursoActual is not None):

                    MiLabel(self, text="Estudiante:"+ self.alu.nombre + self.alu.apellido).grid(row=3, sticky=W)
                    MiLabel(self, text="Curso:" + self.alu.get_course()).grid(row=4, sticky=W)

                    self.btn = MiBoton(self, text="Cobrar", command=self.cobrar)
                    self.btn.grid(row=4, rowspan=1, sticky="e")
                    self.content = MCListDemo(self, 'cuotas')
                    self.content.cargar_item(self.alu.get_cuotas())

                else:
                    messagebox.showinfo("Error", "No esta inscripto a ningun curso")
            except:
                messagebox.showinfo("Error", "Cedula no registrada")
        else:
            messagebox.showinfo("Error", "Cedula no registrada")
    def tomar_test(self):
        """Permite tomar un Test de Ubicacion al alumno."""
        c = self.get_cedula().get()
        w = self.get_write().get()
        r = self.get_read().get()
        l = self.get_listen().get()
        s = self.get_speak().get()

        if (c.isdigit and w.isdigit() and r.isdigit() and l.isdigit()
                and s.isdigit()):
            try:
                self.p = Util.get_posicion_in_list(c)
                if Util.validar_puntajes(w, r, l, s):
                    self.alumno = bd.total_estudiantes[self.p]

                    if (self.alumno.estado == 1 and self.alumno.cursoActual
                            == None):  # 1->>Activo o ya realizo test
                        '''Agrega las notas en el Test de Curso'''
                        notas = {
                            "write": w,
                            "read": r,
                            "listen": l,
                            "speak": s
                        }
                        resul = self.alumno.tomar_test_ubicacion(
                            self.p, notas)  # puntaje 81.25
                        self.opcion = self.evaluar_resul(
                            resul)  # retorna 'basico' 'intermedio' 'avanzado'

                        messagebox.showinfo(
                            "Resultados del Test: ", "Total de Pts ->>" +
                            str(resul) + "\n" + str(self.get_obs(resul)))
                        '''Se escribe el Titulo'''
                        self.cadena = 'INSCRIPCION'
                        self.text = Label(self,
                                          text=self.cadena,
                                          font=("Times", 10,
                                                "bold")).grid(row=11, sticky=N)
                        '''MI boton '''
                        self.btn = MiBoton(self,
                                           text="Matricular",
                                           command=self.inscribir_alumno)
                        self.btn.grid(row=9, rowspan=2, sticky="n")
                        '''Se cargan los cursos habilitados '''

                        self.content = MCListDemo(self, str(self.opcion))

                    else:
                        messagebox.showinfo(
                            "INFO", "Este alumno ya hizo test de Ubicacion "
                            "\n o esta desactivado")
            except:
                messagebox.showinfo("Error", "Cedula no registrada")
        else:
            messagebox.showinfo("Error",
                                "Ingrese numerico para todos los campos")
Beispiel #4
0
    def desactivar(self):
        try:
            fila = self.content.get_item_raw()  #get fila
            cedula = self.content.selecion_item(
            )  # get first column (cedula_estudiante)

            if cedula is not None:
                pos = Util.get_posicion_in_list(int(cedula))
                alumno = bd.total_estudiantes[pos]
                print(alumno.nombre)

                if (alumno.cursoActual != None):
                    for i, var in enumerate(bd.inscriptos):
                        if int(var[0]) == int(alumno.cedula):
                            if (messagebox.askyesno(
                                    "Salir", "Para desactivarlo "
                                    "necesita desincribirlo "
                                    "de su curso actual, "
                                    "desea hacerlo ? ")):
                                alumno.cursoActual = None
                                bd.inscriptos.pop(i)
                                resp = alumno.deshabilitar(pos)
                                messagebox.showinfo("INFO", resp)
                                self.content.eliminar_fila(fila)
                else:
                    resp = alumno.deshabilitar(pos)
                    messagebox.showinfo("INFO", resp)
                    self.content.eliminar_fila(fila)
            else:
                messagebox.showinfo("INFO", " No existe")

        except:
            messagebox.showinfo("INFO", "Seleccione un elemento")
 def validar_campos(self, nom, ape, dire, email):
     if nom != "" and ape != "" and dire != "":
         if Util.val_email(email):
             return True
     else:
         messagebox.showinfo("", "Campos incorrectos")
     return False
Beispiel #6
0
 def cobrar(self):
     try:
         fila = self.content.get_item_raw()  # get fila
         nro_cuota = self.content.selecion_item()  # get first column (nro_cuota)
         if Util.es_ultima_cuota(self.alu, nro_cuota):
             resul = self.alu.pagarCuotas(int(nro_cuota-1))
             self.content.eliminar_fila(fila)
             messagebox.showinfo("Resultado", resul )
         else:
             messagebox.showinfo("INFO", "Seleccione la ultima cuota")
     except:
         messagebox.showinfo("INFO", "Seleccione un elemento")
    def inscribir_alumno(self):
        try:
            nombre_curso = self.content.selecion_item(
            )  # get first column (nombre_curso)
            print(nombre_curso)

            if nombre_curso is not None:
                # get_position of course in list
                pos = Util.get_position(nombre_curso)

                if (Util.no_esta_inscripto(self.alumno.cedula)):  #true
                    texto = self.alumno.set_curso(pos, self.opcion,
                                                  self.alumno)
                    nombre_curso = str(self.alumno.get_course())
                    messagebox.showinfo("INFO", texto + nombre_curso)
                    self.limpiar_campos()
                else:  #si esta inscripto
                    if (self.alumno.get_cuotas() != None):
                        messagebox.showinfo(
                            "INFO",
                            'Inscripcion denegada por mora en el pago de cuotas.'
                        )
                    else:
                        for i, item in enumerate(bd.inscriptos):
                            if (item[0] == self.alumno.cedula):
                                bd.inscriptos.pop(i)
                                break
                        opcion = Util.get_list(nombre_curso)
                        texto = self.alumno.set_curso(pos, opcion, self.alumno)
                        nombre_curso = str(self.alumno.get_course())
                        messagebox.showinfo("INFO", texto + nombre_curso)
                        self.limpiar_campos()

            else:
                messagebox.showinfo("INFO", " Alumno ya inscripto!")

        except:
            messagebox.showinfo("INFO", "Seleccione un curso")
Beispiel #8
0
    def _load_data(self):
        lista = Util.get_lista(self.tipo)

        if lista != None:

            # configure column headings
            for c in self.dataCols:
                self.tree.heading(c,
                                  text=c.title(),
                                  command=lambda c=c: self._column_sort(
                                      c, MCListDemo.SortDir))
                self.tree.column(c, width=Font().measure(c.title()))

            # add data to the tree
            for item in lista:
                self.tree.insert('', 'end', values=item)
            '''
Beispiel #9
0
    def _create_treeview(self, parent):
        f = ttk.Frame(parent)
        f.pack(side=TOP, fill=BOTH, expand=False)

        # create the tree and scrollbars
        self.dataCols = Util.get_titulo(self.tipo)
        self.tree = ttk.Treeview(columns=self.dataCols, show='headings')

        ysb = ttk.Scrollbar(orient=VERTICAL, command=self.tree.yview)
        xsb = ttk.Scrollbar(orient=HORIZONTAL, command=self.tree.xview)
        self.tree['yscroll'] = ysb.set
        self.tree['xscroll'] = xsb.set

        # add tree and scrollbars to frame
        self.tree.grid(in_=f, row=0, column=0, sticky=NSEW)
        ysb.grid(in_=f, row=0, column=1, sticky=NS)
        xsb.grid(in_=f, row=1, column=0, sticky=EW)

        # set frame resize priorities
        f.rowconfigure(0, weight=1)
        f.columnconfigure(0, weight=1)
Beispiel #10
0
    def activar(self):
        try:
            fila = self.content.get_item_raw()  #get fila
            cedula = self.content.selecion_item(
            )  # get first column (cedula_estudiante)

            if cedula is not None:
                pos = Util.get_posicion_in_list(int(cedula))
                self.alumno = bd.total_estudiantes[pos]
                print(self.alumno.nombre)
                try:
                    resp = self.alumno.habilitar(pos)
                    messagebox.showinfo("INFO", resp)
                    self.content.eliminar_fila(fila)

                except:
                    print("No registrado")
            else:
                messagebox.showinfo("INFO", " No existe")

        except:
            messagebox.showinfo("INFO", "Seleccione un elemento")
    def inscribir_alumno(self):
        try:
            selected_item = self.content.selecion_item(
            )  # get first column (nombre_curso)
            lista = self.get_lista_correcta()

            if selected_item is not None:

                #get_position of student in list
                for pos, item in enumerate(lista):
                    if str(item.nombre) == str(selected_item):
                        break

                if (Util.no_esta_inscripto(self.alumno.cedula)):  #true
                    texto = self.alumno.set_curso(pos, self.opcion,
                                                  self.alumno)

                    nombre_curso = str(self.alumno.get_course())
                    #print("texto", texto +nombre_curso)  # inscripcion realizada

                    if (messagebox.askyesno("?", "Se aplicara descuento?")):
                        try:
                            bd.total_estudiantes[self.p].tipo = 1
                            resul = self.alumno.set_cuota(self.p)
                        except:
                            print("no hubo set de cuota")
                    else:
                        bd.total_estudiantes[self.p].tipo = 0
                        resul = self.alumno.set_cuota(self.p)
                    messagebox.showinfo("INFO", texto + nombre_curso)
                    self.limpiar_campos()

                else:
                    messagebox.showinfo("INFO", " Alumno ya inscripto!")
            else:
                messagebox.showinfo("INFO", " No existe")
        except:
            messagebox.showinfo("INFO", "Seleccione un curso")
Beispiel #12
0
    def desinscribir(self):
        try:
            fila = self.content.get_item_raw()  # get fila
            cedula = self.content.selecion_item(
            )  # get first column (cedula_estudiante)

            if cedula is not None:
                pos = Util.get_posicion_in_list(int(cedula))
                alumno = bd.total_estudiantes[pos]
                print(alumno.nombre)
                for i, var in enumerate(bd.inscriptos):
                    if int(var[0]) == int(alumno.cedula):
                        alumno.cursoActual = None
                        alumno.vectorCuotas = []
                        bd.inscriptos.pop(i)
                        self.content.eliminar_fila(fila)
                        messagebox.showinfo("INFO",
                                            "Alumno eliminado del curso")
            else:
                messagebox.showinfo("INFO", " No existe")

        except:
            messagebox.showinfo("INFO", "Seleccione un elemento")
    def tomar_test(self):
        ced = self.get_cedula().get()
        redc = self.get_redcarpets().get()
        asis = self.get_asistencia().get()
        w = self.get_write().get()
        r = self.get_read().get()
        l = self.get_listen().get()
        s = self.get_speak().get()
        """Permite tomar un Test de Ubicacion al alumno."""
        if (ced.isdigit() and redc.isdigit() and asis.isdigit()
                and w.isdigit() and r.isdigit() and l.isdigit()
                and s.isdigit()):
            try:
                pos = Util.get_posicion_in_list(ced)

                if Util.validar_puntajes(w, r, l, s) and Util.val_asistencia(
                        asis, redc):
                    self.alumno = bd.total_estudiantes[pos]
                    ced = self.alumno.cedula

                    if (self.alumno.estado == 1 and self.alumno.cursoActual !=
                            None):  # 1->>Activo o ya realizo test
                        notas = {
                            "write": w,
                            "read": r,
                            "listen": l,
                            "speak": s,
                            "asistencia": asis,
                            "redcarpet": redc
                        }
                        resul = self.alumno.tomar_test_curso(
                            pos, notas)  # puntaje 81.25
                        value = str(self.get_resul(resul))
                        messagebox.showinfo(
                            "Resultados del Test: ",
                            "Total de Pts ->>" + str(resul) + "\n" + value)

                        if (value == 'Curso Aprobado!'):
                            self.cadena = 'Inscribir a nuevo curso'
                            self.text = Label(self,
                                              text=self.cadena,
                                              font=("Times", 10,
                                                    "bold")).grid(row=11,
                                                                  sticky=N)

                            self.btn = MiBoton(self,
                                               text="Inscribir",
                                               command=self.inscribir_alumno)
                            self.btn.grid(row=10, rowspan=2, sticky="n")

                            self.content = MCListDemo(self, 'curso')

                    else:
                        messagebox.showinfo(
                            "INFO", "No esta inscripto a curso  "
                            "\n o esta desactivado")
            except:
                messagebox.showinfo("Error", "Cedula no registrada")
        else:
            messagebox.showinfo("Error",
                                "Ingrese numerico para todos los campos")