Exemplo n.º 1
0
class ListarAvanzados(Frame):
    def __init__(self, master, titulo, opcion):
        Frame.__init__(self, master=master)
        self.pack(expand=1, fill=BOTH)
        self.opcion = opcion

        # label
        self.text = Label(self, text=titulo, font=("Times", 20, "bold"))
        self.text.grid(row=0, sticky=N)

        self.btn = MiBoton(self, text="Borrar", command=self.eliminar)
        self.btn.grid(row=16, rowspan=1, sticky="nw")

        ttk.Separator(self, orient=HORIZONTAL).grid(row=2, sticky="ew")
        self.content = MCListDemo(self, opcion)

    def eliminar(self):
        try:
            fila = self.content.get_item_raw()  # get fila
            nombre = self.content.selecion_item(
            )  # get first column (curso_nombre)
            if nombre is not None:
                for i, valor in enumerate(bd.cursosavanzados):
                    if str(valor.nombre) == str(nombre):
                        print(valor.nombre)
                        print(i)
                        bd.cursosavanzados.pop(i)
                        break
                messagebox.showinfo("INFO", nombre + " Eliminado")
                self.content.eliminar_fila(fila)
            else:
                messagebox.showinfo("ERROR", "Ocurrio un error")
        except:
            messagebox.showinfo("INFO", "Seleccione un elemento")
Exemplo n.º 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")
Exemplo n.º 4
0
    def __init__(self, master):
        Frame.__init__(self, master=master)
        self.pack(expand=1, fill=BOTH)
        '''se define los campos que contendra la ventana'''
        self.nombre = None
        self.duracion = None
        self.horario = None
        self.monto = None
        self.write = None
        self.read = None
        self.listen = None
        self.speak = None
        self.op = StringVar(self)
        self.op.set("basico")
        '''Se escribe el Titulo'''
        self.text = Label(self, text="Curso",
                          font=("Times", 20, "bold")).grid(row=0, sticky=N)

        ttk.Separator(self, orient=HORIZONTAL).grid(row=1, sticky=W + E)

        " Se definen los label con sus correspondiente entrys"
        MiLabel(self, text="Nivel del Curso").grid(row=7, column=2, sticky=E)
        option = OptionMenu(self, self.op, "basico", "intermedio", "avanzado")
        option.grid(row=8, column=2, sticky=E)

        MiLabel(self, text="Nombre *:").grid(row=7, sticky=W)
        MiLabel(self, text="Duracion: ").grid(row=8, sticky=W)
        MiLabel(self, text="Horario: ").grid(row=9, sticky=W)
        MiLabel(self, text="Costo Mensual: ").grid(row=10, sticky=W)
        MiLabel(self,
                text="Puntajes minimos requeridos para aprobar: *:").grid(
                    row=11, sticky=W)
        MiLabel(self, text="Modulo Write *:").grid(row=12, sticky=W)
        MiLabel(self, text="Modulo Read *:").grid(row=13, sticky=W)
        MiLabel(self, text="Modulo Listen *:").grid(row=14, sticky=W)
        MiLabel(self, text="Modulo Speak *:").grid(row=15, sticky=W)

        ttk.Separator(self, orient=HORIZONTAL).grid(row=17, sticky=W + E)
        '''B0ton para guardar/eliminar el curso'''
        self.btn = MiBoton(self, text="Guardar", command=self.add_course)
        self.btn.grid(row=19, rowspan=1, sticky="nw")
        self.btn = MiBoton(self, text="Cancelar", command=self.limpiar_campos)
        self.btn.grid(row=19, rowspan=2, sticky="e")
        '''Frame de listar datos'''
        #self.content = MCListDemo(self, 'curso')

        self.get_nombre()
        self.get_duracion()
        self.get_horario()
        self.get_monto()
        self.get_write()
        self.get_read()
        self.get_listen()
        self.get_speak()
Exemplo n.º 5
0
    def __init__(self, master, titulo, opcion):
        Frame.__init__(self, master=master)
        self.pack(expand=1, fill=BOTH)
        self.opcion = opcion

        # label
        self.text = Label(self, text=titulo, font=("Times", 20, "bold"))
        self.text.grid(row=0, sticky=N)
        self.btn = MiBoton(self, text="Desactivar", command=self.desactivar)
        self.btn.grid(row=16, rowspan=1, sticky="nw")
        ttk.Separator(self, orient=HORIZONTAL).grid(row=2, sticky="ew")

        self.content = MCListDemo(self, opcion)
Exemplo n.º 6
0
class ListarActivos(Frame):
    def __init__(self, master, titulo, opcion):
        Frame.__init__(self, master=master)
        self.pack(expand=1, fill=BOTH)
        self.opcion = opcion

        # label
        self.text = Label(self, text=titulo, font=("Times", 20, "bold"))
        self.text.grid(row=0, sticky=N)
        self.btn = MiBoton(self, text="Desactivar", command=self.desactivar)
        self.btn.grid(row=16, rowspan=1, sticky="nw")
        ttk.Separator(self, orient=HORIZONTAL).grid(row=2, sticky="ew")

        self.content = MCListDemo(self, opcion)

    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")
Exemplo n.º 7
0
    def __init__(self, master):
        Frame.__init__(self, master = master)
        self.pack(expand =1, fill = BOTH)

        '''se define los campos que contendra la ventana'''
        self.cedula = None

        '''Se escribe el Titulo'''
        self.text = Label(self, text="Pago de mensualidad", font=("Times", 20, "bold")).grid(row=0, sticky=N)

        " Se definen los label con sus correspondiente entrys"
        MiLabel(self, text="CDI *:").grid(row=1, sticky=W)

        '''Boton para evaluar el curso'''
        self.btn = MiBoton(self, text="Buscar", command=self.buscar)
        self.btn.grid(row=1, column = 2,  sticky="e")

        self.get_cedula()
Exemplo n.º 8
0
    def __init__(self, master):
        Frame.__init__(self, master=master)
        self.pack(expand=1, fill=BOTH)
        '''se define los campos que contendra la ventana'''
        self.cedula = None
        self.write = None
        self.read = None
        self.listen = None
        self.speak = None
        self.redcarpets = None
        self.asistencia = None
        '''Se escribe el Titulo'''
        self.text = Label(self,
                          text="Evaluacion Final de Curso",
                          font=("Times", 20, "bold")).grid(row=0, sticky=N)

        " Se definen los label con sus correspondiente entrys"
        MiLabel(self, text="Cedula *:").grid(row=2, sticky=W)
        MiLabel(self, text="Cant.Red Carpets:").grid(row=3, sticky=W)
        MiLabel(self, text="Asistencia %*:").grid(row=4, sticky=W)
        MiLabel(self,
                text="Puntajes minimos requeridos para aprobar: *:").grid(
                    row=5, sticky=W)
        MiLabel(self, text="Modulo Write *:").grid(row=6, sticky=W)
        MiLabel(self, text="Modulo Read *:").grid(row=7, sticky=W)
        MiLabel(self, text="Modulo Listen *:").grid(row=8, sticky=W)
        MiLabel(self, text="Modulo Speak *:").grid(row=9, sticky=W)
        '''Boton para evaluar el curso'''
        self.btn = MiBoton(self, text="Calcular", command=self.tomar_test)
        self.btn.grid(row=10, rowspan=1, sticky="nw")

        self.btn = MiBoton(self, text="Cancelar", command=self.limpiar_campos)
        self.btn.grid(row=10, rowspan=2, sticky="ne")
        '''Frame de listar datos
        self.content = MCListDemo(self, 'cursos_habilitados')
        '''

        self.get_cedula()
        self.get_redcarpets()
        self.get_asistencia()
        self.get_write()
        self.get_read()
        self.get_listen()
        self.get_speak()
    def __init__(self, master):
        Frame.__init__(self, master=master)
        self.pack(expand=1, fill=BOTH)
        '''se define los campos que contendra la ventana'''
        self.cedula = None
        self.nombre = None
        self.apellido = None
        self.direccion = None
        self.telefono = None
        self.celular = None
        self.email = None
        '''Se escribe el Titulo'''
        self.text = Label(self, text="Estudiantes",
                          font=("Times", 20, "bold")).grid(row=0, sticky=N)

        ttk.Separator(self, orient=HORIZONTAL).grid(row=1, sticky=W + E)

        " se definen los label con sus correspondiente entrys"
        MiLabel(self, text="Cedula Identidad*:").grid(row=2, sticky=W)
        MiLabel(self, text="Nombre Completo :").grid(row=3, sticky=W)
        MiLabel(self, text="Apellido Completo :").grid(row=4, sticky=W)
        MiLabel(self, text="Direccion :").grid(row=5, sticky=W)
        MiLabel(self, text="Telefono  :").grid(row=6, sticky=W)
        MiLabel(self, text="Celular :").grid(row=7, sticky=W)
        MiLabel(self, text="Correo Electronico:").grid(row=8, sticky=W)

        ttk.Separator(self, orient=HORIZONTAL).grid(row=10, sticky="ew")
        '''Boton para guardar al estudiante'''
        self.btn = MiBoton(self,
                           text="Guardar",
                           command=self.guardarEstudiante)
        self.btn.grid(row=12, column=0, sticky="e")
        self.btn = MiBoton(self, text="Cancelar", command=self.limpiar_campos)
        self.btn.grid(row=12, column=1, sticky="w")
        '''Frame de listar datos'''
        #self.content = MCListDemo(self, 'estudiante')

        self.get_cedula()
        self.get_nombre()
        self.get_apellido()
        self.get_direccion()
        self.get_telefono()
        self.get_celular()
        self.get_email()
Exemplo n.º 10
0
class ListarInscriptos(Frame):
    ''' ventana agregar Estudiante'''
    def __init__(self, master, titulo, opcion):
        Frame.__init__(self, master=master)
        self.pack(expand=1, fill=BOTH)

        # label
        self.text = Label(self, text=titulo, font=("Times", 20, "bold"))
        self.text.grid(row=0, sticky=N)

        self.btn = MiBoton(self,
                           text="Desmatricular",
                           command=self.desinscribir)
        self.btn.grid(row=16, rowspan=1, sticky="nw")
        ttk.Separator(self, orient=HORIZONTAL).grid(row=2, sticky="ew")

        self.content = MCListDemo(self, opcion)

    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")
Exemplo n.º 11
0
class ListarInactivos(Frame):
    def __init__(self, master, titulo, opcion):
        Frame.__init__(self, master=master)
        self.pack(expand=1, fill=BOTH)
        self.opcion = opcion

        # label
        self.text = Label(self, text=titulo, font=("Times", 20, "bold"))
        self.text.grid(row=0, sticky=N)
        self.btn = MiBoton(self, text="Activar", command=self.activar)
        self.btn.grid(row=16, rowspan=1, sticky="nw")

        ttk.Separator(self, orient=HORIZONTAL).grid(row=2, sticky="ew")

        self.content = MCListDemo(self, opcion)

    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 __init__(self, master):
        Frame.__init__(self, master=master)
        self.pack(expand=1, fill=BOTH)
        '''se define los campos que contendra la ventana'''
        self.cedula = None
        self.write = None
        self.read = None
        self.listen = None
        self.speak = None
        '''Se escribe el Titulo'''
        self.text = Label(self,
                          text="Matriculacion - Ubicacion",
                          font=("Times", 20, "bold")).grid(row=0, sticky=N)

        " Se definen los label con sus correspondiente entrys"
        MiLabel(self, text="Cedula *:").grid(row=2, sticky=W)
        MiLabel(self,
                text="Cargue el puntaje hecho en cada examen*:").grid(row=4,
                                                                      sticky=W)
        MiLabel(self, text="Modulo Write *:").grid(row=5, sticky=W)
        MiLabel(self, text="Modulo Read *:").grid(row=6, sticky=W)
        MiLabel(self, text="Modulo Listen *:").grid(row=7, sticky=W)
        MiLabel(self, text="Modulo Speak *:").grid(row=8, sticky=W)
        '''Boton para evaluar el curso'''
        self.btn = MiBoton(self, text="Calcular", command=self.tomar_test)
        self.btn.grid(row=9, rowspan=1, sticky="nw")

        self.btn = MiBoton(self, text="Cancelar", command=self.limpiar_campos)
        self.btn.grid(row=9, rowspan=2, sticky="ne")

        # self.content = MCListDemo(self, 'vacio')

        self.get_cedula()
        self.get_write()
        self.get_read()
        self.get_listen()
        self.get_speak()
class TestUbicacion(Frame):
    def __init__(self, master):
        Frame.__init__(self, master=master)
        self.pack(expand=1, fill=BOTH)
        '''se define los campos que contendra la ventana'''
        self.cedula = None
        self.write = None
        self.read = None
        self.listen = None
        self.speak = None
        '''Se escribe el Titulo'''
        self.text = Label(self,
                          text="Matriculacion - Ubicacion",
                          font=("Times", 20, "bold")).grid(row=0, sticky=N)

        " Se definen los label con sus correspondiente entrys"
        MiLabel(self, text="Cedula *:").grid(row=2, sticky=W)
        MiLabel(self,
                text="Cargue el puntaje hecho en cada examen*:").grid(row=4,
                                                                      sticky=W)
        MiLabel(self, text="Modulo Write *:").grid(row=5, sticky=W)
        MiLabel(self, text="Modulo Read *:").grid(row=6, sticky=W)
        MiLabel(self, text="Modulo Listen *:").grid(row=7, sticky=W)
        MiLabel(self, text="Modulo Speak *:").grid(row=8, sticky=W)
        '''Boton para evaluar el curso'''
        self.btn = MiBoton(self, text="Calcular", command=self.tomar_test)
        self.btn.grid(row=9, rowspan=1, sticky="nw")

        self.btn = MiBoton(self, text="Cancelar", command=self.limpiar_campos)
        self.btn.grid(row=9, rowspan=2, sticky="ne")

        # self.content = MCListDemo(self, 'vacio')

        self.get_cedula()
        self.get_write()
        self.get_read()
        self.get_listen()
        self.get_speak()

    def get_cedula(self):
        if not self.cedula:
            self.cedula = Entry(master=self, width=20)
            self.cedula.grid(row=2, sticky=E)
            self.cedula.focus()
        return self.cedula

    def get_write(self):
        if not self.write:
            self.write = Entry(master=self, width=20)
            self.write.grid(row=5, sticky=E)
        return self.write

    def get_read(self):
        if not self.read:
            self.read = Entry(master=self, width=20)
            self.read.grid(row=6, sticky=E)
        return self.read

    def get_listen(self):
        if not self.listen:
            self.listen = Entry(master=self, width=20)
            self.listen.grid(row=7, sticky=E)
        return self.listen

    def get_speak(self):
        if not self.speak:
            self.speak = Entry(master=self, width=20)
            self.speak.grid(row=8, sticky=E)
        return self.speak

    def limpiar_campos(self):
        self.get_cedula().delete(0, END)
        self.get_write().delete(0, END)
        self.get_read().delete(0, END)
        self.get_listen().delete(0, END)
        self.get_speak().delete(0, END)

    def validar_campos(self, w, r, l, s):
        if w.isdigit() and r.isdigit() and l.isdigit() and s.isdigit():
            return True
        else:
            messagebox.showinfo("", "Campos Vacios")
        return False

    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")

    def cancelar(self):
        self.limpiar_campos()

    def evaluar_resul(self, resul):
        int(resul)
        if (resul <= 74): return 'basico'
        if (resul >= 75 and resul <= 94): return 'intermedio'
        if (resul >= 95): return 'avanzado'

    def get_obs(self, resul):
        int(resul)
        if (resul <= 74): return ('Nivel de Ingles ->> Basico')
        if (resul >= 75 and resul <= 94):
            return ('Nivel de Ingles ->> Intermedio')
        if (resul >= 95): return ('Nivel de Ingles ->> Avanzado')

    def get_lista_correcta(self):
        if self.opcion == 'basico':
            return bd.cursosbasicos
        elif self.opcion == 'intermedio':
            return bd.cursosintermedios
        elif self.opcion == 'avanzado':
            return bd.cursosavanzados

    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")
Exemplo n.º 14
0
class AgregarCurso(Frame):
    '''Agregar/Eliminar un curso'''
    def __init__(self, master):
        Frame.__init__(self, master=master)
        self.pack(expand=1, fill=BOTH)
        '''se define los campos que contendra la ventana'''
        self.nombre = None
        self.duracion = None
        self.horario = None
        self.monto = None
        self.write = None
        self.read = None
        self.listen = None
        self.speak = None
        self.op = StringVar(self)
        self.op.set("basico")
        '''Se escribe el Titulo'''
        self.text = Label(self, text="Curso",
                          font=("Times", 20, "bold")).grid(row=0, sticky=N)

        ttk.Separator(self, orient=HORIZONTAL).grid(row=1, sticky=W + E)

        " Se definen los label con sus correspondiente entrys"
        MiLabel(self, text="Nivel del Curso").grid(row=7, column=2, sticky=E)
        option = OptionMenu(self, self.op, "basico", "intermedio", "avanzado")
        option.grid(row=8, column=2, sticky=E)

        MiLabel(self, text="Nombre *:").grid(row=7, sticky=W)
        MiLabel(self, text="Duracion: ").grid(row=8, sticky=W)
        MiLabel(self, text="Horario: ").grid(row=9, sticky=W)
        MiLabel(self, text="Costo Mensual: ").grid(row=10, sticky=W)
        MiLabel(self,
                text="Puntajes minimos requeridos para aprobar: *:").grid(
                    row=11, sticky=W)
        MiLabel(self, text="Modulo Write *:").grid(row=12, sticky=W)
        MiLabel(self, text="Modulo Read *:").grid(row=13, sticky=W)
        MiLabel(self, text="Modulo Listen *:").grid(row=14, sticky=W)
        MiLabel(self, text="Modulo Speak *:").grid(row=15, sticky=W)

        ttk.Separator(self, orient=HORIZONTAL).grid(row=17, sticky=W + E)
        '''B0ton para guardar/eliminar el curso'''
        self.btn = MiBoton(self, text="Guardar", command=self.add_course)
        self.btn.grid(row=19, rowspan=1, sticky="nw")
        self.btn = MiBoton(self, text="Cancelar", command=self.limpiar_campos)
        self.btn.grid(row=19, rowspan=2, sticky="e")
        '''Frame de listar datos'''
        #self.content = MCListDemo(self, 'curso')

        self.get_nombre()
        self.get_duracion()
        self.get_horario()
        self.get_monto()
        self.get_write()
        self.get_read()
        self.get_listen()
        self.get_speak()

    def get_nombre(self):
        if not self.nombre:
            self.nombre = Entry(master=self, width=20)
            self.nombre.grid(row=7, sticky=E)
            self.nombre.focus()
        return self.nombre

    def get_duracion(self):
        if not self.duracion:
            self.duracion = Entry(master=self, width=20)
            self.duracion.grid(row=8, sticky=E)
        return self.duracion

    def get_horario(self):
        if not self.horario:
            self.horario = Entry(master=self, width=20)
            self.horario.grid(row=9, sticky=E)
        return self.horario

    def get_monto(self):
        if not self.monto:
            self.monto = Entry(master=self, width=20)
            self.monto.grid(row=10, sticky=E)
        return self.monto

    def get_write(self):
        if not self.write:
            self.write = Entry(master=self, width=20)
            self.write.grid(row=12, sticky=E)
        return self.write

    def get_read(self):
        if not self.read:
            self.read = Entry(master=self, width=20)
            self.read.grid(row=13, sticky=E)
        return self.read

    def get_listen(self):
        if not self.listen:
            self.listen = Entry(master=self, width=20)
            self.listen.grid(row=14, sticky=E)
        return self.listen

    def get_speak(self):
        if not self.speak:
            self.speak = Entry(master=self, width=20)
            self.speak.grid(row=15, sticky=E)
        return self.speak

    def val_duracion(self, dur):
        val = False
        if dur.isdigit() and int(dur) <= 12:
            val = True
        else:
            messagebox.showinfo("", "La duracion es en  0meses. Numerico.")
        return val

    def val_monto(self, mon):
        val = False
        if mon.isdigit():
            val = True
        else:
            messagebox.showinfo("", "El monto debe ser solo numerico")
        return val

    def val_modulos(self, mod):
        val = False
        if mod.isdigit() and int(mod) <= 100:
            val = True
        else:
            messagebox.showinfo("", "El limite para puntajes es de 100 Pts.")
        return val

    def limpiar_campos(self):
        self.get_nombre().delete(0, END)
        self.get_duracion().delete(0, END)
        self.get_horario().delete(0, END)
        self.get_monto().delete(0, END)
        self.get_write().delete(0, END)
        self.get_read().delete(0, END)
        self.get_listen().delete(0, END)
        self.get_speak().delete(0, END)

    def get_lista_correcta(self, nombre):
        for var in bd.cursosbasicos:
            if str(var.nombre) == str(nombre):
                return bd.cursosbasicos
        for var in bd.cursosintermedios:
            if var.nombre == nombre:
                return bd.cursosintermedios
        for var in bd.cursosavanzados:
            if var.nombre == nombre:
                return bd.cursosavanzados

    def validar_campos(self, nom, hor):
        val = False
        if nom != "" and hor != "":
            return True
        else:
            messagebox.showinfo("", "Campos Vacios")
        return False

    # operaciones para registar Cursos
    # --------------------------------------------------------------------------

    def add_course(self):
        self.nom = self.get_nombre().get()
        self.dur = self.get_duracion().get()
        self.hor = self.get_horario().get()
        self.mon = self.get_monto().get()
        self.w = self.get_write().get()
        self.r = self.get_read().get()
        self.l = self.get_listen().get()
        self.s = self.get_speak().get()

        if self.validar_campos(self.nom, self.hor):
            if self.val_duracion(self.dur) and self.val_monto(self.mon) and self.val_modulos(self.w) and \
                self.val_modulos(self.r) and self.val_modulos(self.l) and self.val_modulos(self.s):

                x = self.guardar(self.op.get())
                x()

                messagebox.showinfo("Correcto", "Datos Guardados")
                self.limpiar_campos()

    def guardar(self, lang):
        def es_basico():
            bd.cursosbasicos.append(
                basico(
                    **{
                        "nombre": self.nom,
                        "duracion": self.dur,
                        "horario": self.hor,
                        "monto": self.mon,
                        "write": self.w,
                        "read": self.r,
                        "listen": self.l,
                        "speak": self.s
                    }))

        def es_avanzado():
            bd.cursosavanzados.append(
                avanzado(
                    **{
                        "nombre": self.nom,
                        "duracion": self.dur,
                        "horario": self.hor,
                        "monto": self.mon,
                        "write": self.w,
                        "read": self.r,
                        "listen": self.l,
                        "speak": self.s
                    }))

        def es_intermedio():
            bd.cursosintermedios.append(
                intermedio(
                    **{
                        "nombre": self.nom,
                        "duracion": self.dur,
                        "horario": self.hor,
                        "monto": self.mon,
                        "write": self.w,
                        "read": self.r,
                        "listen": self.l,
                        "speak": self.s
                    }))

        lang_func = {
            'basico': es_basico,
            'intermedio': es_intermedio,
            'avanzado': es_avanzado
        }
        return lang_func[lang]
Exemplo n.º 15
0
class PagarCuota(Frame):

    def __init__(self, master):
        Frame.__init__(self, master = master)
        self.pack(expand =1, fill = BOTH)

        '''se define los campos que contendra la ventana'''
        self.cedula = None

        '''Se escribe el Titulo'''
        self.text = Label(self, text="Pago de mensualidad", font=("Times", 20, "bold")).grid(row=0, sticky=N)

        " Se definen los label con sus correspondiente entrys"
        MiLabel(self, text="CDI *:").grid(row=1, sticky=W)

        '''Boton para evaluar el curso'''
        self.btn = MiBoton(self, text="Buscar", command=self.buscar)
        self.btn.grid(row=1, column = 2,  sticky="e")

        self.get_cedula()

    def get_cedula(self):
        if not self.cedula:
            self.cedula = Entry(master=self, width=20)
            self.cedula.grid(row=1, sticky=E)
            self.cedula.focus()
        return self.cedula

    def limpiar_campos(self):
        self.get_cedula().delete(0, END)

    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 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 cancelar(self):
        self.limpiar_campos()
class AgregarEstudiante(Frame):
    ''' ventana agregar Estudiante'''
    def __init__(self, master):
        Frame.__init__(self, master=master)
        self.pack(expand=1, fill=BOTH)
        '''se define los campos que contendra la ventana'''
        self.cedula = None
        self.nombre = None
        self.apellido = None
        self.direccion = None
        self.telefono = None
        self.celular = None
        self.email = None
        '''Se escribe el Titulo'''
        self.text = Label(self, text="Estudiantes",
                          font=("Times", 20, "bold")).grid(row=0, sticky=N)

        ttk.Separator(self, orient=HORIZONTAL).grid(row=1, sticky=W + E)

        " se definen los label con sus correspondiente entrys"
        MiLabel(self, text="Cedula Identidad*:").grid(row=2, sticky=W)
        MiLabel(self, text="Nombre Completo :").grid(row=3, sticky=W)
        MiLabel(self, text="Apellido Completo :").grid(row=4, sticky=W)
        MiLabel(self, text="Direccion :").grid(row=5, sticky=W)
        MiLabel(self, text="Telefono  :").grid(row=6, sticky=W)
        MiLabel(self, text="Celular :").grid(row=7, sticky=W)
        MiLabel(self, text="Correo Electronico:").grid(row=8, sticky=W)

        ttk.Separator(self, orient=HORIZONTAL).grid(row=10, sticky="ew")
        '''Boton para guardar al estudiante'''
        self.btn = MiBoton(self,
                           text="Guardar",
                           command=self.guardarEstudiante)
        self.btn.grid(row=12, column=0, sticky="e")
        self.btn = MiBoton(self, text="Cancelar", command=self.limpiar_campos)
        self.btn.grid(row=12, column=1, sticky="w")
        '''Frame de listar datos'''
        #self.content = MCListDemo(self, 'estudiante')

        self.get_cedula()
        self.get_nombre()
        self.get_apellido()
        self.get_direccion()
        self.get_telefono()
        self.get_celular()
        self.get_email()

    def get_cedula(self):
        if not self.cedula:
            self.cedula = Entry(master=self, width=20)
            self.cedula.grid(row=2, column=1)
            self.cedula.focus()
        return self.cedula

    def get_nombre(self):
        if not self.nombre:
            self.nombre = Entry(master=self, width=20)
            self.nombre.grid(row=3, column=1)
        return self.nombre

    def get_apellido(self):
        if not self.apellido:
            self.apellido = Entry(master=self, width=20)
            self.apellido.grid(row=4, column=1)
        return self.apellido

    def get_direccion(self):
        if not self.direccion:
            self.direccion = Entry(master=self, width=20)
            self.direccion.grid(row=5, column=1)
        return self.direccion

    def get_telefono(self):
        if not self.telefono:
            self.telefono = Entry(master=self, width=20)
            self.telefono.grid(row=6, column=1)
        return self.telefono

    def get_celular(self):
        if not self.celular:
            self.celular = Entry(master=self, width=20)
            self.celular.grid(row=7, column=1)
        return self.celular

    def get_email(self):
        if not self.email:
            self.email = Entry(master=self, width=20)
            self.email.grid(row=8, column=1)
        return self.email

    def cancelar(self):
        if (self.master):
            self.master.destroy()

    def limpiar_campos(self):
        self.get_cedula().delete(0, END)
        self.get_nombre().delete(0, END)
        self.get_apellido().delete(0, END)
        self.get_direccion().delete(0, END)
        self.get_telefono().delete(0, END)
        self.get_celular().delete(0, END)
        self.get_email().delete(0, END)

    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

    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")
Exemplo n.º 17
0
    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")
Exemplo n.º 18
0
class TestCurso(Frame):
    def __init__(self, master):
        Frame.__init__(self, master=master)
        self.pack(expand=1, fill=BOTH)
        '''se define los campos que contendra la ventana'''
        self.cedula = None
        self.write = None
        self.read = None
        self.listen = None
        self.speak = None
        self.redcarpets = None
        self.asistencia = None
        '''Se escribe el Titulo'''
        self.text = Label(self,
                          text="Evaluacion Final de Curso",
                          font=("Times", 20, "bold")).grid(row=0, sticky=N)

        " Se definen los label con sus correspondiente entrys"
        MiLabel(self, text="Cedula *:").grid(row=2, sticky=W)
        MiLabel(self, text="Cant.Red Carpets:").grid(row=3, sticky=W)
        MiLabel(self, text="Asistencia %*:").grid(row=4, sticky=W)
        MiLabel(self,
                text="Puntajes minimos requeridos para aprobar: *:").grid(
                    row=5, sticky=W)
        MiLabel(self, text="Modulo Write *:").grid(row=6, sticky=W)
        MiLabel(self, text="Modulo Read *:").grid(row=7, sticky=W)
        MiLabel(self, text="Modulo Listen *:").grid(row=8, sticky=W)
        MiLabel(self, text="Modulo Speak *:").grid(row=9, sticky=W)
        '''Boton para evaluar el curso'''
        self.btn = MiBoton(self, text="Calcular", command=self.tomar_test)
        self.btn.grid(row=10, rowspan=1, sticky="nw")

        self.btn = MiBoton(self, text="Cancelar", command=self.limpiar_campos)
        self.btn.grid(row=10, rowspan=2, sticky="ne")
        '''Frame de listar datos
        self.content = MCListDemo(self, 'cursos_habilitados')
        '''

        self.get_cedula()
        self.get_redcarpets()
        self.get_asistencia()
        self.get_write()
        self.get_read()
        self.get_listen()
        self.get_speak()

    def get_cedula(self):
        if not self.cedula:
            self.cedula = Entry(master=self, width=20)
            self.cedula.grid(row=2, sticky=E)
            self.cedula.focus()
        return self.cedula

    def get_redcarpets(self):
        if not self.redcarpets:
            self.redcarpets = Entry(master=self, width=20)
            self.redcarpets.grid(row=3, sticky=E)
            self.redcarpets.focus()
        return self.redcarpets

    def get_asistencia(self):
        if not self.asistencia:
            self.asistencia = Entry(master=self, width=20)
            self.asistencia.grid(row=4, sticky=E)
            self.asistencia.focus()
        return self.asistencia

    def get_write(self):
        if not self.write:
            self.write = Entry(master=self, width=20)
            self.write.grid(row=6, sticky=E)
        return self.write

    def get_read(self):
        if not self.read:
            self.read = Entry(master=self, width=20)
            self.read.grid(row=7, sticky=E)
        return self.read

    def get_listen(self):
        if not self.listen:
            self.listen = Entry(master=self, width=20)
            self.listen.grid(row=8, sticky=E)
        return self.listen

    def get_speak(self):
        if not self.speak:
            self.speak = Entry(master=self, width=20)
            self.speak.grid(row=9, sticky=E)
        return self.speak

    def limpiar_campos(self):
        self.get_cedula().delete(0, END)
        self.get_redcarpets().delete(0, END)
        self.get_asistencia().delete(0, END)
        self.get_write().delete(0, END)
        self.get_read().delete(0, END)
        self.get_listen().delete(0, END)
        self.get_speak().delete(0, END)

    def validar_campos(self, c, redc, asis, w, r, l, s):
        val = False
        if (c.isdigit() and redc.isdigit() and asis.isdigit() and w.isdigit()
                and r.isdigit() and l.isdigit() and s.isdigit()):
            return True
        else:
            messagebox.showinfo("", "Campos Vacios")
        return False

    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")

    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")

    def cancelar(self):
        self.limpiar_campos()

    def get_resul(self, resul):
        if (resul >= 60):
            return ("Curso Aprobado!")
        else:
            return ("Curso No aprobado!")