Example #1
0
 def update_course(self):
     if not self.rows:
         messagebox.showerror("Error",
                              "Choose a course from the table first")
     elif self.edit_course_id_entry.get(
     ) == "" or self.edit_course_text.get(1.0, END) == "":
         messagebox.showerror("Error", "Please fill all fields")
         return
     else:
         if messagebox.askyesno(
                 "Update Course",
                 "Do you wish to update the course information? Some students might"
                 " be enrolled in this course?"):
             if SISdatabase.update_course_rec(
                     self.rows[0],
                     self.course_id.get().upper(),
                     self.edit_course_text.get(1.0, END).upper().replace(
                         "\n", "")):
                 messagebox.showinfo(
                     "Success", "Information on course has been updated!")
                 self.clear_data()
                 self.rows = []
                 disp.display_course_table(self.course_table)
             return
         else:
             return
Example #2
0
    def add_course(self):
        if self.add_course_id_entry.get() == "" or self.add_course_text.get(1.0, END) == "":
            messagebox.showerror("Error", "Please fill all fields")
            return

        else:
            if messagebox.askyesno("Add Course", "Do you wish to add the course to database?"):
                if SISdatabase.add_course_rec(self.course_id.get().upper(),
                                              self.add_course_text.get(1.0, END).upper().replace("\n", "")):
                    messagebox.showinfo("Success", "Course added to database.")
                    self.clear_data()
                    displaytable.display_course_table(self.course_table)
                else:
                    return
            else:
                return
Example #3
0
 def delete_course(self):
     cursor_row = self.course_table.focus()
     contents = self.course_table.item(cursor_row)
     rows = contents['values']
     if rows == "":
         messagebox.showerror("Error", "Select course first")
         return
     else:
         if messagebox.askyesno(
                 "Delete Course",
                 "Do you wish to delete this course? Some students might be enrolled"
                 " in this course."):
             if SISdatabase.delete_course_rec(rows[0]):
                 disp.display_course_table(self.course_table)
                 messagebox.showinfo("Success",
                                     "Course deleted in database")
                 self.default_layout()
             return
         else:
             return
Example #4
0
    def __init__(self, frame):
        self.courses_cont_frame = frame

        self.search_course_id = StringVar()

        self.add_button_img = PhotoImage(
            file=r"images\addcourse.png").subsample(1, 1)
        self.edit_button_img = PhotoImage(
            file=r"images\editcourse.png").subsample(1, 1)
        self.delete_button_img = PhotoImage(
            file=r"images\deletecourse.png").subsample(1, 1)
        self.srch_img = PhotoImage(
            file=r"images\searchbuttonimg.png").subsample(1, 1)

        add_course_btn = Button(self.courses_cont_frame,
                                image=self.add_button_img,
                                bg="#A51d23",
                                command=self.add_course)
        add_course_btn.photo = self.add_button_img
        add_course_btn.place(x=10, y=50, width=70, height=70)

        edit_course_btn = Button(self.courses_cont_frame,
                                 image=self.edit_button_img,
                                 bg="#A51d23",
                                 command=self.edit_course)
        edit_course_btn.photo = self.edit_button_img
        edit_course_btn.place(x=85, y=50, width=70, height=70)

        delete_course_btn = Button(self.courses_cont_frame,
                                   image=self.delete_button_img,
                                   bg="#A51d23",
                                   command=self.delete_course)
        delete_course_btn.photo = self.delete_button_img
        delete_course_btn.place(x=160, y=50, width=70, height=70)

        search_code_label = Label(self.courses_cont_frame,
                                  font=("Blinker", 11, "bold"),
                                  bg="#A51d23",
                                  fg="white",
                                  text="Course ID:")
        search_code_label.place(x=515, y=85, width=80, height=35)
        self.search_course_bar_entry = Entry(
            self.courses_cont_frame,
            textvariable=self.search_course_id,
            font=("Blinker", 15, "bold"),
            highlightthickness=2,
            highlightbackground="#A51d23")
        self.search_course_bar_entry.place(x=595, y=85, width=250, height=35)
        self.search_course_id.trace("w",
                                    lambda name, index, mode, sv=self.
                                    search_course_id: self.search_course())
        search_course_lbl = Label(self.courses_cont_frame, image=self.srch_img)
        search_course_lbl.photo = self.srch_img
        search_course_lbl.place(x=845, y=85, width=35, height=35)

        courselist_label = Label(self.courses_cont_frame,
                                 bg="#A51d23",
                                 fg="white",
                                 text="   LIST OF COURSES",
                                 font=("Blinker", 15, "bold"),
                                 anchor='w')
        courselist_label.place(x=370, y=140, width=510, height=30)

        self.course_list_frame = Frame(self.courses_cont_frame,
                                       bg="white",
                                       highlightbackground="#A51d23",
                                       highlightthickness=2)
        self.course_list_frame.place(x=370, y=170, width=510, height=370)

        scroll_x_course_list = Scrollbar(self.course_list_frame,
                                         orient=HORIZONTAL)
        scroll_y_course_list = Scrollbar(self.course_list_frame,
                                         orient=VERTICAL)
        self.course_table = ttk.Treeview(
            self.course_list_frame,
            xscrollcommand=scroll_x_course_list.set,
            yscrollcommand=scroll_y_course_list.set,
            columns=("course_code", "course"))
        scroll_x_course_list.pack(side=BOTTOM, fill=X)
        scroll_y_course_list.pack(side=RIGHT, fill=Y)
        scroll_x_course_list.config(command=self.course_table.xview)
        scroll_y_course_list.config(command=self.course_table.yview)
        self.course_table.heading("course_code", text="Course Code")
        self.course_table.heading("course", text="Course")
        self.course_table['show'] = 'headings'
        self.course_table.column("course_code", width=120)
        self.course_table.column("course", width=390)

        self.course_table.pack(fill=BOTH, expand=1)

        self.heading_label = Label(self.courses_cont_frame,
                                   bg="#A51d23",
                                   fg="white",
                                   anchor='w',
                                   text="",
                                   font=("Blinker", 15, "bold"))
        self.heading_label.place(x=10, y=140, width=340, height=30)

        self.features_frame = Frame(self.courses_cont_frame,
                                    bg="white",
                                    highlightbackground="#A51d23",
                                    highlightthickness=2)
        self.add_course_frame = Frame(self.courses_cont_frame,
                                      bg="white",
                                      highlightbackground="#A51d23",
                                      highlightthickness=2)
        self.edit_course_frame = Frame(self.courses_cont_frame,
                                       bg="white",
                                       highlightbackground="#A51d23",
                                       highlightthickness=2)

        self.default_layout()
        disp.display_course_table(self.course_table)
Example #5
0
    def __init__(self, frame):
        self.dashboard_cont_frame = frame

        self.student_dshbrd_img = PhotoImage(file=r"images\dashboardstud.png")
        student_count_dash = Label(self.dashboard_cont_frame,
                                   image=self.student_dshbrd_img)
        student_count_dash.photo = self.student_dshbrd_img
        student_count_dash.place(x=20, y=20, width=250, height=120)
        self.student_count = Label(self.dashboard_cont_frame,
                                   text="1000",
                                   font=("Blinker", 40, "bold"),
                                   fg="#A51d23",
                                   bg="#FA9412")
        self.student_count.place(x=20, y=20, width=140, height=77)

        self.course_dshbrd_img = PhotoImage(file=r"images\dashboardcourse.png")
        course_count_dash = Label(self.dashboard_cont_frame,
                                  image=self.course_dshbrd_img)
        course_count_dash.photo = self.course_dshbrd_img
        course_count_dash.place(x=290, y=20, width=250, height=120)
        self.course_count = Label(self.dashboard_cont_frame,
                                  text="0",
                                  font=("Blinker", 40, "bold"),
                                  bg="#A51d23",
                                  fg="#FA9412")
        self.course_count.place(x=290, y=20, width=140, height=77)

        self.bg_frame = Frame(self.dashboard_cont_frame, bg="white")

        self.stud_list_label = Label(self.dashboard_cont_frame,
                                     bg="#A51d23",
                                     fg="white",
                                     text="  LIST OF STUDENTS",
                                     font=("Blinker", 15, "bold"),
                                     anchor="w")
        self.stud_list_frame = Frame(self.dashboard_cont_frame,
                                     bg="white",
                                     highlightbackground="#A51d23",
                                     highlightthickness=2)

        self.course_label = Label(self.dashboard_cont_frame,
                                  bg="#A51d23",
                                  fg="white",
                                  text="  LIST OF COURSES",
                                  font=("Blinker", 15, "bold"),
                                  anchor="w")
        self.course_list_frame = Frame(self.dashboard_cont_frame,
                                       bg="white",
                                       highlightbackground="#A51d23",
                                       highlightthickness=2)

        scroll_x_stud_list = Scrollbar(self.stud_list_frame, orient=HORIZONTAL)
        scroll_y_stud_list = Scrollbar(self.stud_list_frame, orient=VERTICAL)

        scroll_x_course_list = Scrollbar(self.course_list_frame,
                                         orient=HORIZONTAL)
        scroll_y_course_list = Scrollbar(self.course_list_frame,
                                         orient=VERTICAL)
        self.student_table = ttk.Treeview(
            self.stud_list_frame,
            xscrollcommand=scroll_x_stud_list.set,
            yscrollcommand=scroll_y_stud_list.set,
            columns=("id_no", "name", "course_code", "year", "gender"))
        scroll_x_stud_list.pack(side=BOTTOM, fill=X)
        scroll_y_stud_list.pack(side=RIGHT, fill=Y)
        scroll_x_stud_list.config(command=self.student_table.xview)
        scroll_y_stud_list.config(command=self.student_table.yview)
        self.student_table.heading("id_no", text="ID Number")
        self.student_table.heading("name", text="Name")
        self.student_table.heading("course_code", text="Course Code")
        self.student_table.heading("year", text="Year")
        self.student_table.heading("gender", text="Gender")
        self.student_table['show'] = 'headings'
        self.student_table.column("id_no", width=70)
        self.student_table.column("name", width=190)
        self.student_table.column("course_code", width=100)
        self.student_table.column("year", width=70)
        self.student_table.column("gender", width=70)

        self.student_table.pack(fill=BOTH, expand=1)

        self.course_table = ttk.Treeview(
            self.course_list_frame,
            xscrollcommand=scroll_x_course_list.set,
            yscrollcommand=scroll_y_course_list.set,
            columns=("course_code", "course"))
        scroll_x_course_list.pack(side=BOTTOM, fill=X)
        scroll_y_course_list.pack(side=RIGHT, fill=Y)
        scroll_x_course_list.config(command=self.course_table.xview)
        scroll_y_course_list.config(command=self.course_table.yview)
        self.course_table.heading("course_code", text="Course Code")
        self.course_table.heading("course", text="Course")
        self.course_table['show'] = 'headings'
        self.course_table.column("course_code", width=50)
        self.course_table.column("course", width=200)

        self.course_table.pack(fill=BOTH, expand=1)

        self.max_student_img = PhotoImage(file=r"images\max.png").subsample(
            5, 5)
        self.max_course_img = PhotoImage(file=r"images\max.png").subsample(
            5, 5)
        self.max_student_button = Button(self.dashboard_cont_frame,
                                         command=self.max_student_table,
                                         relief=FLAT,
                                         bg="#A51d23",
                                         activebackground="#A51d23",
                                         image=self.max_student_img)
        self.max_course_button = Button(self.dashboard_cont_frame,
                                        command=self.max_course_table,
                                        relief=FLAT,
                                        bg="#A51d23",
                                        activebackground="#A51d23",
                                        image=self.max_course_img)

        self.min_image = PhotoImage(file=r"images\min.png").subsample(5, 5)
        self.min_button = Button(self.dashboard_cont_frame,
                                 command=self.default_layout,
                                 relief=FLAT,
                                 fg="white",
                                 bg="#A51d23",
                                 activeforeground="white",
                                 activebackground="#A51d23",
                                 image=self.min_image)
        self.min_button.photo = self.min_image

        self.default_layout()
        self.count_data()
        disp.display_student_table(self.student_table)
        disp.display_course_table(self.course_table)