コード例 #1
0
    def search_standards(self, f):
        f.destroy()
        f = Form()
        f.search_screen()

        frame = tk.Frame()
        frame.pack(pady=10)

        button_frame = tk.Frame(frame)
        button_frame.pack()

        var = tk.IntVar()

        R1 = tk.Radiobutton(button_frame, text="Subject", variable=var, value=1)
        R1.pack(pady=2)

        new_search_button = tk.Button(button_frame, text="Search",
                                      command=lambda: self.view_standards(f, 1, f.search_box.get()))
        new_search_button.pack(pady=2)

        view_all_button = tk.Button(button_frame, text="View All",
                                      command=lambda: self.view_standards(f, 0, f.search_box.get()))
        view_all_button.pack(pady=2)

        back_button = tk.Button(button_frame, text="Back",
                                command=lambda: self.main_screen(self.user.accessLevel, self.user, f))
        back_button.pack(pady=15)

        return None
コード例 #2
0
    def student_view_reports(self, f):
        f.destroy()
        f = Form()

        feedback = self.search(thing_to_match=self.user.get_student_id(), file_name_to_search="studentReports", split_type=",")
        #t(feedback[0])

        edu_list = list()
        feedback_list = list()
        for x in feedback:
            count = 0
            for y in x:
                if count == 0:
                    count += 1
                    continue
                elif count == 1:
                    edu = self.search(str(y), "educators", "\t")
                    edu_list.append(edu[0][4] + " " + edu[0][5])
                else:
                    feedback_list.append(y)
                count += 1

        f.view_edu_feedback(edu_list[0], feedback_list[0])

        frame = tk.Frame()
        frame.pack(pady=10)

        button_frame = tk.Frame(frame)
        button_frame.pack()

        back_button = tk.Button(button_frame, text="Back",
                                command=lambda: self.main_screen(self.user.accessLevel, self.user, f))
        back_button.pack(pady=2)

        return None
コード例 #3
0
    def view_student(self, access_level, stu, f):
        f.destroy()
        f = Form()

        # get the data form the obj
        data = [stu.get_name(), stu.get_student_id(), stu.get_current_grade(), stu.get_current_institution(),
                stu.get_home_address(), stu.get_emergency_contact(), stu.get_relationship(), stu.get_ec_email(),
                stu.get_medical_notes(), stu.get_grades()]

        f.view_student(access_level, data)

        frame = tk.Frame()
        frame.pack(pady=10)

        button_frame = tk.Frame(frame)
        button_frame.pack()

        back = tk.Button(button_frame, text="Back", command=lambda: self.main_screen(access_level, self.user, f))
        back.pack(side=tk.LEFT, padx=10)

        if access_level == 1:
            notes = tk.Button(button_frame, text="Add Notes", command=lambda: self.add_notes(f, stu))
            notes.pack(side=tk.LEFT, pady=10)

        return None
コード例 #4
0
    def search_student_form(self,  access_level, f):
        f.destroy()
        f = Form()
        f.search_screen()

        frame = tk.Frame()
        frame.pack(pady=10)

        button_frame = tk.Frame(frame)
        button_frame.pack()

        var = tk.IntVar()

        R1 = tk.Radiobutton(button_frame, text="Last Name", variable=var, value=1)
        R1.pack(pady=2)

        R2 = tk.Radiobutton(button_frame, text="Student Id", variable=var, value=2)
        R2.pack(pady=2)

        new_search_button = tk.Button(button_frame, text="Search",
                                      command=lambda: self.search_for_student(access_level, f, var.get(),
                                                                              f.search_box.get()))
        new_search_button.pack(pady=2)

        back_button = tk.Button(button_frame, text="Back",
                                      command=lambda: self.main_screen(self.user.accessLevel, self.user, f))
        back_button.pack(pady=2)

        return None
コード例 #5
0
    def feedback_search(self, f):
        f.destroy()
        f = Form()
        f.search_screen()

        frame = tk.Frame()
        frame.pack(pady=10)

        button_frame = tk.Frame(frame)
        button_frame.pack()

        var = tk.IntVar()

        #R1 = tk.Radiobutton(button_frame, text="Last Name", variable=var, value=1)
        #R1.pack(pady=2)

        R2 = tk.Radiobutton(button_frame, text="Educator Id", variable=var, value=2)
        R2.pack(pady=2)

        new_search_button = tk.Button(button_frame, text="Search",
                                      command=lambda: self.view_feedback(f.search_box.get(), f))
        new_search_button.pack(pady=2)

        back_button = tk.Button(button_frame, text="Back",
                                command=lambda: self.main_screen(self.user.accessLevel, self.user, f))
        back_button.pack(pady=2)

        return None
コード例 #6
0
    def view_standards(self, f, flag, data):
        f.destroy()
        f = Form()

        # do init search for all standards fore a given inst then filter
        id = int()

        if type(self.user) == Student:
            id = self.user.get_inst_id()
        elif type(self.user) == Educator:
            id = self.user.currentInst
        else:
            id = self.user.get_id()

        rows = self.search(thing_to_match=str(id), file_name_to_search="standards", split_type=",")

        #print(rows)
        standards_list = list()
        if flag == 1:
            # search
            pass
        else:
            # view all
            for x in rows:
                count = 0
                sub = ""
                for y in x:
                    if count == 0:
                        count += 1
                        continue
                    elif count == 1:
                        sub = y
                    else:
                        a_range = y
                        standards_list.append(Standards(subject=sub, acc_range=a_range))

                    count += 1

        f.view_standards(standards=standards_list)

        frame = tk.Frame()
        frame.pack(pady=10)

        button_frame = tk.Frame(frame)
        button_frame.pack()

        back_button = tk.Button(button_frame, text="Back",
                                command=lambda: self.main_screen(self.user.accessLevel, self.user, f))
        back_button.pack(pady=15)

        return None
コード例 #7
0
    def educator_creation(self, f):
        f.destroy()
        f = Form()

        f.add_new(1)

        frame = tk.Frame()
        frame.pack(pady=10)

        button_frame = tk.Frame(frame)
        button_frame.pack()

        back = tk.Button(button_frame, text="Back", command=lambda: self.main_screen(0, None, f))
        back.pack(side=tk.LEFT, padx=10)

        save_button = tk.Button(button_frame, text="Save", command=lambda: self.create_educator_obj(f.get_educator_data(), True, f))
        save_button.pack(side=tk.LEFT)

        return None
コード例 #8
0
    def add_notes(self, f, student):
        f.destroy()
        f = Form()

        f.add_note()
        frame = tk.Frame()
        frame.pack(pady=10)

        button_frame = tk.Frame(frame)
        button_frame.pack()

        add = tk.Button(button_frame, text="Add",
                        command=lambda: self.write_note(f, student.get_student_id(), f.get_note()))
        add.pack(side=tk.LEFT, pady=10)

        back = tk.Button(button_frame, text="Back", command=lambda: self.main_screen(1, self.user, f))
        back.pack(side=tk.LEFT, pady=10)

        return None
コード例 #9
0
    def view_feedback(self, data, f):
        f.destroy()
        f = Form()
        name = None
        for edu in self.edu_list:
            if edu.get_id() == data:
                name = edu.get_name()
                f.view_edu_feedback(name, edu.get_feedback())

        frame = tk.Frame()
        frame.pack(pady=10)

        button_frame = tk.Frame(frame)
        button_frame.pack()

        back_button = tk.Button(button_frame, text="Back",
                                command=lambda: self.main_screen(self.user.accessLevel, self.user, f))
        back_button.pack(pady=2)

        return None
コード例 #10
0
    def view_inst(self,access_level, inst, f):
        f.destroy()
        f = Form()

        # get the data form the obj
        data = [inst.get_name(), inst.get_address(), inst.get_institution_type(),
                inst.get_grade_min(), inst.get__grade_max(), inst.get_main_phone_num()]

        f.view_institution(access_level, data)

        frame = tk.Frame()
        frame.pack(pady=10)

        button_frame = tk.Frame(frame)
        button_frame.pack()

        back = tk.Button(button_frame, text="Back", command=lambda: self.main_screen(access_level, None, f))
        back.pack(side=tk.LEFT, padx=10)

        return None
コード例 #11
0
    def view_all_edu_courses(self, f, flag):
        f.destroy()
        f = Form()

        if flag == 0:
            f.view_courses(self.edu_list, flag)
        else:
            #print(type(self.user.get_courses()))
            f.view_courses(self.user.get_courses(), 1)

        frame = tk.Frame()
        frame.pack(pady=10)

        button_frame = tk.Frame(frame)
        button_frame.pack()

        back = tk.Button(button_frame, text="Back", command=lambda: self.main_screen(0, None, f))
        back.pack(side=tk.LEFT, padx=10)

        return None
コード例 #12
0
    def log_in(self, f):
        f.destroy()
        f = Form()

        f.log_in()

        frame = tk.Frame()
        frame.pack(pady=10)

        button_frame = tk.Frame(frame)
        button_frame.pack()

        close_button = tk.Button(button_frame, text="Close", command=f.destroy)
        close_button.pack(side=tk.LEFT, padx=10)

        log_in_button = tk.Button(button_frame, text="Log In",
                                  command=lambda: self.log_in_search(f.get_login_data(), f))
        log_in_button.pack(side=tk.LEFT, padx=10)

        return None
コード例 #13
0
    def first_creation(self, f):
        f.destroy()
        f = Form()

        f.add_new(0)

        frame = tk.Frame()
        frame.pack(pady=10)

        button_frame = tk.Frame(frame)
        button_frame.pack()

        back = tk.Button(button_frame, text="Close", command=f.destroy)
        back.pack(side=tk.LEFT, padx=10)

        save_button = tk.Button(button_frame, text="Save",
                                command=lambda: self.create_institution_obj(f.get_institution_data(), True, f))
        save_button.pack(side=tk.LEFT)

        return None
コード例 #14
0
    def view_student_standards(self, f, access_level, opt_outlier=False):
        f.destroy()
        f = Form()

        compareStandardList = list()
        #instStudents = self.search(self.user.get_id(), "students", "\t")

        if access_level is 0:
           # use the student list to get their standards
            for student in self.stu_list:
                newVM = ViewStdViewModel()
                newVM = self.process_standards(student.get_student_id(), opt_outlier=opt_outlier)
                if newVM is not None:
                    newVM.persons = student.get_name()
                    compareStandardList.append(newVM)
        elif access_level is 1:
            # students
            self.stu_list = list()
            self.get_inst_students(str(self.user.currentInst))
            for student in self.stu_list:
                newVM = ViewStdViewModel()
                newVM = self.process_standards(student.get_student_id(), edu_inst_id=self.user.currentInst)
                newVM.persons = student.get_name()
                compareStandardList.append(newVM)
        elif access_level is 2:
            vm = self.proccess_standards_as_stu()
            compareStandardList.append(vm)

        f.view_others_standards(compareStandardList)

        frame = tk.Frame()
        frame.pack(pady=10)

        button_frame = tk.Frame(frame)
        button_frame.pack()

        back = tk.Button(button_frame, text="Back", command=lambda: self.main_screen(access_level, self.user, f))
        back.pack(side=tk.LEFT, pady=10)

        return None
コード例 #15
0
    def view_edu(self, access_level, edu, f):
        f.destroy()
        f = Form()

        # get the data from the obj
        data = [edu.get_name()]
        data.extend(edu.get_personal_info())
        data.extend(edu.get_professional_info())
        #print(data)

        f.view_educator(access_level, data)

        frame = tk.Frame()
        frame.pack(pady=10)

        button_frame = tk.Frame(frame)
        button_frame.pack()

        back = tk.Button(button_frame, text="Back", command=lambda: self.main_screen(access_level, None, f))
        back.pack(side=tk.LEFT, padx=10)

        return None
コード例 #16
0
    def bulk_student_creation(self, f):
        f.destroy()
        f = Form()
        f.bulk_add_records()

        frame = tk.Frame()
        frame.pack(pady=10)

        button_frame = tk.Frame(frame)
        button_frame.pack()

        opts = tk.Listbox(button_frame, selectmode='single')
        opts.grid(row=0, rowspan=1, column=1, sticky="w")
        opts.pack(pady=2)
        opts.insert(1, "Educators")
        opts.insert(2, "Students")
        getfile = tk.Button(button_frame, text="Get File", command=lambda: self.read_upload_file(opts.curselection()[0]+1))
        getfile.pack(pady=2)
        back_button = tk.Button(button_frame, text="Back",
                                      command=lambda: self.main_screen(self.user.accessLevel, self.user, f))
        back_button.pack(pady=2)

        return None
コード例 #17
0
    def view_my_grades(self, f):
        f.destroy()
        f = Form()

        grades = self.search(thing_to_match=self.user.get_student_id(), file_name_to_search="grades",
                               split_type=",")

        sub_list = list()
        grade_list = list()
        for x in grades:
            count = 0
            for y in x:
                if count == 0:
                    count += 1
                    continue
                elif count == 1:
                    sub_list.append(y)
                else:
                    grade_list.append(y)
                count += 1

        print("grades", grade_list)
        print("subject", sub_list)

        f.view_grade(subject_list=sub_list, grade_list=grade_list)

        frame = tk.Frame()
        frame.pack(pady=10)

        button_frame = tk.Frame(frame)
        button_frame.pack()

        back = tk.Button(button_frame, text="Back", command=lambda: self.main_screen(2, self.user, f))
        back.pack(side=tk.LEFT, pady=10)

        return None
コード例 #18
0
    def start_screen(self):
        f = Form()

        go = f.start_screen()

        frame = tk.Frame(go)
        frame.pack(pady=100)

        institution_frame = tk.Frame(frame)
        institution_frame.pack()

        log_in_frame = tk.Frame(frame)
        log_in_frame.pack(pady=30)

        log_in_button = tk.Button(log_in_frame, text="Log In", command=lambda: self.log_in(f))
        log_in_button.pack(side=tk.LEFT)

        institution_button = tk.Button(institution_frame, text="Create new Institution",
                                       command=lambda: self.first_creation(f))
        institution_button.pack(side=tk.LEFT)

        go.mainloop()

        return None
コード例 #19
0
    def main_screen(self, access_level, user, f):
        f.destroy()

        f = Form()
        f.main_screen()

        frame = tk.Frame()
        frame.pack(pady=50)

        header = tk.Frame(frame)
        header.pack()

        all_buttons = tk.Frame(frame)
        all_buttons.pack()

        button_col_1 = tk.Frame(all_buttons)
        button_col_1.pack(side=tk.LEFT)
        button_col_2 = tk.Frame(all_buttons)
        button_col_2.pack(side=tk.LEFT)

        button_frame = tk.Frame(button_col_1)
        button_frame.pack()

        button_frame_1 = tk.Frame(button_col_2)
        button_frame_1.pack()

        button_frame_2 = tk.Frame(button_col_1)
        button_frame_2.pack()

        button_frame_3 = tk.Frame(button_col_2)
        button_frame_3.pack()

        button_frame_4 = tk.Frame(button_col_1)
        button_frame_4.pack()

        button_frame_5 = tk.Frame(button_col_2)
        button_frame_5.pack()

        button_frame_6 = tk.Frame(button_col_1)
        button_frame_6.pack()

        button_frame_7 = tk.Frame(button_col_2)
        button_frame_7.pack()

        button_frame_8 = tk.Frame(button_col_1)
        button_frame_8.pack()

        button_frame_9 = tk.Frame(button_col_2)
        button_frame_9.pack()

        standards_frame = tk.Frame(button_col_1)
        standards_frame.pack()

        button_frame_10 = tk.Frame(button_col_2)
        button_frame_10.pack()

        close_frame = tk.Frame(frame)
        close_frame.pack(side=tk.BOTTOM)

        welcome_label = tk.Label(header, text=self.user.get_name()+"'s Dashboard",font='bold')
        welcome_label.pack()

        if access_level is 0:
            new_edu_button = tk.Button(button_frame, text="Add Educator", command=lambda: self.educator_creation(f))
            new_edu_button.pack(side=tk.LEFT, pady=10)

            """
                new_inst_button = tk.Button(button_frame_1, text="New Institution",
                                        command=lambda: self.institution_creation(f))
                new_inst_button.pack(side=tk.LEFT, pady=10)
            """

            new_student_button = tk.Button(button_frame_1, text="Add Student",
                                           command=lambda: self.student_creation(f))
            new_student_button.pack(side=tk.LEFT, pady=10)

            bulk_student_button = tk.Button(button_frame_2, text="Bulk Add Records",
                                           command=lambda: self.bulk_student_creation(f))
            bulk_student_button.pack(side=tk.LEFT, pady=10)

            view_edu_button = tk.Button(button_frame_3, text="View Educator",
                                        command=lambda: self.search_edu_form(0, f))
            view_edu_button.pack(side=tk.LEFT, pady=10)

            view_inst_button = tk.Button(button_frame_4, text="View Institution",
                                         command=lambda: self.view_inst(0, user, f))
            view_inst_button.pack(side=tk.LEFT, pady=10)

            view_student_button = tk.Button(button_frame_5, text="View Student",
                                            command=lambda: self.search_student_form(0, f))
            view_student_button.pack(side=tk.LEFT, pady=10)

            view_edu_courses = tk.Button(button_frame_6, text="All Educator Courses",
                                            command=lambda: self.view_all_edu_courses(f, 0))
            view_edu_courses.pack(side=tk.LEFT, pady=10)

            view_edu_feedback = tk.Button(button_frame_7, text="Educator Feedback",
                                         command=lambda: self.feedback_search(f))
            view_edu_feedback.pack(side=tk.LEFT, pady=10)

            """ id 11 view outliers """
            view_outliers = tk.Button(button_frame_8, text="View Outliers",
                                          command=lambda: self.view_student_standards(f, 0, opt_outlier=True))
            view_outliers.pack(side=tk.LEFT, pady=10)

            """ id 15 view all students compared to standards """
            view_student_std = tk.Button(button_frame_9, text="Student Standards",
                                      command=lambda: self.view_student_standards(f, 0))
            view_student_std.pack(side=tk.LEFT, pady=10)

            view_stats = tk.Button(button_frame_10, text="View Statistics",
                                   command=lambda: self.view_inst_stats(f, self.user.get_id()))
            view_stats.pack(side=tk.LEFT,pady=10)

        if access_level is 1:
            view_edu_button = tk.Button(button_frame_1, text="View Educator", command=lambda: self.view_edu(1, user, f))
            view_edu_button.pack(side=tk.LEFT, pady=10)

            view_inst_button = tk.Button(button_frame_2, text="View Institution",
                                         command=lambda: self.view_inst(1, self.user.view_inst(), f))
            view_inst_button.pack(side=tk.LEFT, pady=10)

            view_student_button = tk.Button(button_frame_3, text="View Student",
                                            command=lambda: self.search_student_form(1, f))
            view_student_button.pack(side=tk.LEFT, pady=10)

            view_edu_courses = tk.Button(button_frame_4, text="View All Courses",
                                         command=lambda: self.view_all_edu_courses(f, 1))
            view_edu_courses.pack(side=tk.LEFT, pady=10)

            """ to work on backlog id 8 """
            student_standards = tk.Button(button_frame_5, text="How are my students doing",
                                         command=lambda: self.view_student_standards(f, 1))
            student_standards.pack(side=tk.LEFT, pady=10)

        if access_level is 2:
            view_student_button = tk.Button(button_frame_1, text="View Student",
                                            command=lambda: self.view_student(2, user, f))
            view_student_button.pack(side=tk.LEFT, pady=10)

            view_inst_button = tk.Button(button_frame_2, text="View Institution",
                                         command=lambda: self.view_inst(2, self.user.view_inst(), f))
            view_inst_button.pack(side=tk.LEFT, pady=10)

            view_edu_button = tk.Button(button_frame_3, text="View Educators",
                                        command=lambda: self.search_edu_form(2, f))
            view_edu_button.pack(side=tk.LEFT, pady=10)

            view_stu_reports = tk.Button(button_frame_4, text="View My Reports",
                                        command=lambda: self.student_view_reports(f))
            view_stu_reports.pack(side=tk.LEFT, pady=10)

            view_grades = tk.Button(button_frame_5, text="My Grades/Course History",
                                         command=lambda: self.view_my_grades(f))
            view_grades.pack(side=tk.LEFT, pady=10)

            student_standards = tk.Button(button_frame_6, text="How am I doing",
                                          command=lambda: self.view_student_standards(f, 2))
            student_standards.pack(side=tk.LEFT, pady=10)

        standards_button = tk.Button(standards_frame, text="Standards", command=lambda: self.search_standards(f))
        standards_button.pack(side=tk.LEFT, pady=10)

        close_button = tk.Button(close_frame, text="Log Out", command=lambda: self.log_in(f))
        close_button.pack(side=tk.LEFT, pady=25)

        return None
コード例 #20
0
    def view_inst_stats(self, f, inst_id):
        f.destroy()
        f = Form()

        s_list = list()
        e_list = list()

        script_dir = os.path.dirname(__file__)  # absolute dir the script is in
        rel_path_s = "db/students.txt"
        abs_s_file_path = os.path.join(script_dir, rel_path_s)

        rel_path_e = "db/educators.txt"
        abs_e_file_path = os.path.join(script_dir, rel_path_e)

        with open(abs_s_file_path) as fullList:
            content = fullList.readlines()
            content = [x.strip() for x in content]
            for line in content:
                split = line.split('\t')  # choose split type
                if split[12] == str(inst_id):
                    s_list.append(split)

        with open(abs_e_file_path) as fullList:
            content = fullList.readlines()
            content = [x.strip() for x in content]
            for line in content:
                split = line.split('\t')  # choose split type
                if split[14] == str(inst_id):
                    e_list.append(split)

        grade_count = [0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0]

        for student in s_list:
            if student[11] == 'K':
                grade_count[0] += 1
            else:
                grade_count[int(student[11])] += 1

        e_text = str(len(e_list))
        s_text = str(len(s_list))
        g_list = ""
        g_text = ""

        min_g = self.user.grade_min
        if min_g == 'K':
            min_g = '0'
        max_g = self.user.grade_max

        for i in range(int(min_g),int(max_g)+1):
            if i == 0:
                g_list += "Kindergarten:\n"
                g_text += str(grade_count[i]) + '\n'
            else:
                g_list += "Grade " + str(i) + ":\n"
                g_text += str(grade_count[i]) + '\n'

        f.view_inst_stats(e_text, s_text, g_list, g_text)

        frame = tk.Frame()
        frame.pack(pady=10)

        button_frame = tk.Frame(frame)
        button_frame.pack()

        back = tk.Button(button_frame, text="Back",
                         command=lambda: self.main_screen(self.user.accessLevel, self.user, f))
        back.pack(side=tk.LEFT, pady=10)
コード例 #21
0
    def get_standards(self, standards):
        f = Form()

        f.view_standards(standards)

        return None