def pack_run_button(self): core_logic.clear_frame(self.action_frame) self.message_label.config( text="Click on the Run Button to finish the task.") tkinter.Button(self.action_frame, text="Run", command=lambda: eval(self.command)).pack(side="bottom")
def update_options_frame(self, event): if self.pop_up is not None: self.pop_up.destroy() w = event.widget index = int(w.curselection()[0]) a = self.assignments[index] core_logic.clear_frame(self.action_frame) self.message_label.config(text="You Selected " + a.name + ". Select an Option to Continue.") core_logic.clear_frame(self.options_frame) self.selected_assignment = a self.reviews = core_logic.get_peer_reviews(a) self.rubric = core_logic.get_rubric(self.selected_course, a.id) self.students_dict = core_logic.make_students_dict( core_logic.get_students(self.selected_course), self.selected_course, self.selected_assignment, self.reviews, self.rubric) self.options_frame.delete(0, 'end') self.options_frame.insert('end', "Generate CSV") self.options_frame.insert('end', "Create Statistics Json") self.options_frame.insert('end', "Create Assignment & Upload Grades") self.options_frame.insert('end', "Upload Grades to Existing Assignment") self.options_frame.bind('<<ListboxSelect>>', self.update_secondary_options_frame)
def create_assignment(self): core_logic.creat_new_assignment(self.selected_assignment, self.selected_course, self.students_dict, self.selected_assignment_group.id) core_logic.clear_frame(self.action_frame) self.assignments = core_logic.get_assignments_with_peer_reviews( self.selected_course) self.assignments_frame.delete(0, 'end') self.pack_assignments() self.message_label.config( text="New Assignment Created.\nselect another Option to continue.")
def generate_stats(self): path = filedialog.asksaveasfilename( initialdir=os.getcwd(), title="Select file", initialfile=str(self.selected_assignment.id) + "_statistics.json", filetypes=(("json files", "*.json"), ("all files", "*.*"))) core_logic.export_statistics(self.students_dict, self.rubric, path) core_logic.clear_frame(self.action_frame) self.options_frame.selection_clear(0, 'end') self.message_label.config( text="Statistics JSON exported.\nselect another Option to continue." )
def generate_csv(self): path = filedialog.asksaveasfilename( initialdir=os.getcwd(), title="Select file", initialfile=str(self.selected_assignment.id) + "_peer_review.csv", filetypes=(("csv files", "*.csv"), ("all files", "*.*"))) core_logic.generate_csv(self.students_dict, self.selected_assignment.id, path, self.rubric) core_logic.clear_frame(self.action_frame) self.options_frame.selection_clear(0, 'end') self.message_label.config( text="CSV exported.\nselect another Option to continue.")
def validate_grade_upload(self): self.pop_up.destroy() if core_logic.assignment_already_graded(self.upload_grades_to): core_logic.clear_frame(self.action_frame) self.message_label.config( text=self.upload_grades_to.name + " Has Existing Grades. Do You Want to Overwrite Grades?") tkinter.Button( self.action_frame, text="Yes", command=lambda: eval(self.command)).pack(side="left") tkinter.Button(self.action_frame, text="No", command=lambda: self.update_options_frame( self.selected_assignment)).pack(side="left") else: self.pack_run_button()
def update_secondary_options_frame(self, event): if self.pop_up is not None: self.pop_up.destroy() w = event.widget index = int(w.curselection()[0]) self.command = self.functions_list[index] core_logic.clear_frame(self.action_frame) if index == 3: self.pack_assignments_to_upload_grades() self.message_label.config( text= "Select an assignment in the secondary options menu to upload the grades." ) elif index == 2: self.pack_assignment_groups() self.message_label.config(text="Select an assignment group.") else: self.pack_run_button()
def upload_grades(self, assignment): core_logic.clear_frame(self.action_frame) core_logic.upload_grades( assignment, core_logic.make_grade_dictionary(self.students_dict)) self.message_label.config(text="Grades Uploaded to " + self.upload_grades_to.name + ".")