def edit(self, tasks=None, edits=None): tasks = tasks or [] editcommand = command.EditTaskCommand(self.taskList, tasks) for task in tasks: task.setSubject('New subject') task.setDescription('New description') task.setBudget(date.TimeDelta(hours=1)) task.setCompletionDate() att = attachment.FileAttachment('attachment') if att in task.attachments(): task.removeAttachments(att) else: task.addAttachments(att) if self.category in task.categories(): task.removeCategory(self.category) else: task.addCategory(self.category) for edit in edits or []: edit() editcommand.do()
def addAttachments(self): for task in self.items: task.addAttachments(*self.__attachments)