def quit_app(self): """Callback for quit button. This method callback for the quit button verifies the user wants to quit the application and if they click yes, saves the data to the filesystem using the save_data method of the datautils module. """ ans = askokcancel('Verify exit', 'Really quit?') if ans: datautils.save_data(self.datalist) self.parent.quit()
def update_task(self): """Method to insert the updated Task data into the datalist. This method inserts the updated Task data from the edit window to the datalist Task list. It also saves the updated datalist to the filesystem using the save_data method of the datautils module. """ updatedtask = Task(self.editTitle.get(), self.editDesc.get(), PRIORITY_VALUE[self.editPriority.get()], self.editDue.get(), self.editCompleted.get()) self.datalist[self.selected] = updatedtask self.onRadioChange() self.editwindow.destroy() self.selPriority.set('') self.priorityLabel.config(fg='black') self.selTitle.set('Click A Task To Select') self.selDesc.set('') self.selDue.set('') self.selComplete.set('') self.selected = None datautils.save_data(self.datalist)
def delete_task(self): """Callback method for the Delete selected task button. This method deletes the selected Task object from the datalist. It also saves the updated datalist to the filesystem using the save_data method of the datautils module. """ if self.selected: ans = askokcancel('Delete Task', 'Are you sure you want to delete the selected task?') if ans: self.datalist.pop(self.selected) self.selPriority.set('') self.priorityLabel.config(fg='black') self.selTitle.set('Click A Task To Select') self.selDesc.set('') self.selDue.set('') self.selComplete.set('') self.selected = None self.cFrame.destroy() self.draw_canvas_frame(self.canvas, self.datalist) datautils.save_data(self.datalist) else: showerror('No Selection Error', 'Nothing is Selected!')