def nextstep(self):
        cid = database.course_id(self.CourseName.get())
        self.assignementlist = database.select_assignment(cid)
        self.studentlist = database.select_student_from_course(
            self.CourseName.get())

        if (self.assignementlist == ()):
            self.assignementlist = ("None")

        if (self.studentlist == ()):
            self.studentlist = ("None")

        tk.Label(self.operationsFrame, text="Assignments  :").grid(column=0,
                                                                   row=1)
        tk.Spinbox(self.operationsFrame,
                   fg="blue",
                   font=12,
                   textvariable=self.AssignmentName,
                   values=self.assignementlist).grid(column=1, row=1)
        tk.Label(self.operationsFrame, text="students  :").grid(column=0,
                                                                row=2)
        tk.Spinbox(self.operationsFrame,
                   fg="blue",
                   font=12,
                   textvariable=self.StudentName,
                   values=self.studentlist).grid(column=1, row=2)
        tk.Label(self.operationsFrame, text="Grade ( /100) :").grid(column=0,
                                                                    row=3,
                                                                    pady=4)
        tk.Entry(self.operationsFrame, width=25,
                 textvariable=self.GradeValue).grid(column=1, row=3, pady=4)

        tk.Label(self.operationsFrame, text="Comment :").grid(column=0,
                                                              row=4,
                                                              pady=4)
        tk.Entry(self.operationsFrame, width=25,
                 textvariable=self.Remark).grid(column=1, row=4, pady=4)

        tk.Button(self.operationsFrame,
                  text="Confirm",
                  command=self.add_grade,
                  borderwidth=3,
                  width=6,
                  height=1).grid(column=0, row=5, pady=10)
        tk.Button(self.operationsFrame,
                  text="cancel",
                  borderwidth=3,
                  width=6,
                  height=1).grid(column=1, row=5, pady=10)
    def show_announcements(self):
        cid = database.course_id(self.CourseName.get())
        announcements = database.select_announcemnts(cid)

        tk.Label(self.operationsFrame, text="Title").grid(column=0, row=4)
        tk.Label(self.operationsFrame, text="Announcement").grid(column=1,
                                                                 row=4)

        j = 5
        i = 0
        while (i < len(announcements)):
            tk.Label(self.operationsFrame,
                     text=announcements[i][0]).grid(column=0, row=j)
            tk.Label(self.operationsFrame,
                     text=announcements[i][1]).grid(column=1, row=j)
            i += 1
            j += 1
    def next_step(self):

        cid = database.course_id(self.CourseName.get())
        result = database.select_assignment(cid)

        tk.Label(self.operationsFrame, text="Choose a file  :").grid(column=0,
                                                                     row=1)
        tk.Spinbox(self.operationsFrame,
                   fg="blue",
                   font=12,
                   textvariable=self.HomeworkFiles,
                   values=result).grid(column=1, row=1)
        tk.Button(self.operationsFrame,
                  text="Download",
                  command=self.download,
                  borderwidth=3,
                  width=7,
                  height=1).grid(column=3, row=1, pady=10)
Exemple #4
0
    def method_annoc(self):
        data = self.text.get("1.0", "end-1c")
        result = ""
        # self.announcementDescr.set(data)
        #
        # print(self.announcementDescr)
        for line in data.split():
            result += " " + line
        print(result)

        self.announcementDescr.set(result)
        cid = database.course_id(self.CourseName.get())
        database.add_announce(cid, self.announcementTitle.get(),
                              self.announcementDescr.get())

        result = database.show_announce(cid)
        i = 4
        for announce in result:
            tk.Label(self.operationsFrame, text=announce).grid(column=0,
                                                               row=i,
                                                               pady=4)
            i = i + 1
    def show_grades(self):

        cid=database.course_id(self.CourseName.get())
        assid=database.select_assignment_ids(cid)

        tk.Label(self.operationsFrame, text="assignments").grid(column=0, row=4)
        tk.Label(self.operationsFrame, text="grade").grid(column=1, row=4)
        tk.Label(self.operationsFrame, text="description").grid(column=2, row=4)
        gradesandremark=database.select_course_grades(assid)
        homeworks=database.select_assignment_names(assid)

        i=5
        for ass in homeworks:
            tk.Label(self.operationsFrame, text=ass).grid(column=0, row=i)
            i+=1
        j=5
        e=0
        while(e < len(gradesandremark)):
            tk.Label(self.operationsFrame,text=gradesandremark[e]).grid(column=1,row=j)
            tk.Label(self.operationsFrame, text=gradesandremark[e+1]).grid(column=2, row=j)
            e+=2
            j+=1
    def download(self):

        cid = database.course_id(self.CourseName.get())
        chname = self.HomeworkFiles.get()

        # path=database.file_course_path(cid, chname)

        # path ="C:\\Users\\salah\\Desktop\\bridgeport\\08138300024025.pdf"

        path = "https://www.virginiawestern.edu/learning/elit/faculty/docs/bb/Coursefiles.pdf"

        r = requests.get(path, stream=True)

        chunk_size = 1024

        total_size = int(r.headers['content-length'])

        with open(chname + ".pdf", 'wb') as f:
            for data in tqdm(iterable=r.iter_content(chunk_size=chunk_size),
                             total=total_size / chunk_size,
                             unit='KB'):
                f.write(data)

        print("Download complete!")
Exemple #7
0
    def teacherOperations(self, controller):

        buttonFrame = tk.Frame(self)

        self.filename = self.fileDialog

        courseNames = database.select_courses()

        tk.Label(self.operationsFrame, text="Course  :").grid(column=0, row=0)
        tk.Spinbox(self.operationsFrame,
                   fg="blue",
                   font=12,
                   textvariable=self.CourseName,
                   values=courseNames).grid(column=1, row=0)
        tk.Label(self.operationsFrame, text="Assignment Name :").grid(column=0,
                                                                      row=1,
                                                                      pady=4)
        tk.Entry(self.operationsFrame, width=25,
                 textvariable=self.Assignment).grid(column=1, row=1, pady=4)

        tk.Label(self.operationsFrame, text="Assignment File :").grid(column=0,
                                                                      row=2,
                                                                      pady=4)

        tk.Button(self.operationsFrame,
                  text="upload",
                  command=self.filename,
                  borderwidth=3,
                  width=6,
                  height=1).grid(column=1, row=2, pady=10)

        tk.Button(self.operationsFrame,
                  text="Submit",
                  command=lambda: controller.add_assignemnt_file(
                      database.course_id(self.CourseName.get()),
                      self.Assignment.get(), self.filename),
                  borderwidth=3,
                  width=6,
                  height=1).grid(column=0, row=6, pady=10)

        tk.Button(self.operationsFrame,
                  text="Cancel",
                  borderwidth=3,
                  width=6,
                  height=1).grid(column=1, row=6, pady=10)

        b1 = tk.Button(
            buttonFrame,
            text="Lecture Files ",
            command=lambda: controller.show_frame(StudentApp.CourseFiles),
            borderwidth=4,
            width=24,
            height=3)
        b2 = tk.Button(buttonFrame,
                       text="Assignments",
                       command=lambda: controller.show_frame(
                           StudentApp.CourseAssignments),
                       borderwidth=4,
                       width=24,
                       height=3)
        b3 = tk.Button(
            buttonFrame,
            text="Add a student",
            command=lambda: controller.show_frame(StudentApp.CourseStudents),
            borderwidth=4,
            width=24,
            height=3)
        b4 = tk.Button(
            buttonFrame,
            text="Grades",
            command=lambda: controller.show_frame(StudentApp.CourseGrades),
            borderwidth=4,
            width=24,
            height=3)
        b5 = tk.Button(buttonFrame,
                       text="Announcements",
                       command=lambda: controller.show_frame(
                           StudentApp.CourseAnnouncements),
                       borderwidth=4,
                       width=24,
                       height=3)
        b6 = tk.Button(
            buttonFrame,
            text="Log Out",
            command=lambda: controller.show_frame(StudentApp.LoginWindow),
            borderwidth=4,
            width=24,
            height=3)

        b1.grid(column=0, row=0)
        b2.grid(column=0, row=1)
        b3.grid(column=0, row=3)
        b4.grid(column=0, row=4)
        b5.grid(column=0, row=5)
        b6.grid(column=0, row=6)

        buttonFrame.grid(column=0, row=0)
        self.operationsFrame.grid(column=1, row=0, padx=5)