Ejemplo n.º 1
0
 def _createSelectionFile(self, tasks, TaskFileClass):
     selectionFile = TaskFileClass()
     selectionFile.tasks().extend(tasks)
     allCategories = set()
     for task in tasks:
         allCategories.update(task.categories())
     selectionFile.categories().extend(allCategories)
     return selectionFile
Ejemplo n.º 2
0
 def __init__(self, parent, task, categories, *args, **kwargs):
     super(CategoriesPage, self).__init__(parent, task, *args, **kwargs)
     self.__categories = category.CategorySorter(categories)
     categoriesBox = widgets.BoxWithBoxSizer(self, label=_('Categories'))
     self._treeCtrl = widgets.CheckTreeCtrl(categoriesBox, 
         lambda index: self.getCategoryWithIndex(index).subject(),
         lambda *args: None,
         lambda index, expanded=False: -1, 
         lambda index: customtree.TreeItemAttr(),
         self.getChildrenCount, 
         lambda index: 'Undetermined', 
         lambda index: self.getCategoryWithIndex(index) in task.categories(),
         lambda *args: None, lambda *args: None, lambda *args: None,
         lambda *args: None)
     self._treeCtrl.expandAllItems()
     categoriesBox.add(self._treeCtrl, proportion=1, flag=wx.EXPAND|wx.ALL)
     categoriesBox.fit()
     self.add(categoriesBox)
     self.fit()
Ejemplo n.º 3
0
 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()
Ejemplo n.º 4
0
 def do_command(self):
     super(EditTaskCommand, self).do_command()
     self.newCategories = [task.categories() for task in self.items]
     self.updateCategories(self.oldCategories, self.newCategories)
Ejemplo n.º 5
0
 def __init__(self, *args, **kwargs):
     super(EditTaskCommand, self).__init__(*args, **kwargs)
     self.oldCategories = [task.categories() for task in self.items]