Пример #1
0
 def parallel_children(self, item, recursive=False):
     try:
         children = [child for child in item.children(recursive=recursive) \
                     if child in self.presentation()]
         children.sort(key=lambda task: task.startDateTime())
         return children
     except AttributeError:
         return []
Пример #2
0
 def taskNode(self, task): # pylint: disable-msg=W0621
     maxDateTime = self.maxDateTime
     node = self.baseCompositeNode(task, 'task', self.taskNode)
     node.setAttribute('status', str(task.getStatus()))
     if task.startDateTime() != maxDateTime:
         node.setAttribute('startdate', str(task.startDateTime()))
     if task.dueDateTime() != maxDateTime:
         node.setAttribute('duedate', str(task.dueDateTime()))
     if task.completionDateTime() != maxDateTime:
         node.setAttribute('completiondate', str(task.completionDateTime()))
     if task.percentageComplete() != 0:
         node.setAttribute('percentageComplete', str(task.percentageComplete()))
     if task.recurrence():
         node.appendChild(self.recurrenceNode(task.recurrence()))
     if task.budget() != date.TimeDelta():
         node.setAttribute('budget', self.budgetAsAttribute(task.budget()))
     if task.priority() != 0:
         node.setAttribute('priority', str(task.priority()))
     if task.hourlyFee() != 0:
         node.setAttribute('hourlyFee', str(task.hourlyFee()))
     if task.fixedFee() != 0:
         node.setAttribute('fixedFee', str(task.fixedFee()))
     if task.reminder() != None:
         node.setAttribute('reminder', str(task.reminder()))
     prerequisiteIds = ' '.join([prerequisite.id() for prerequisite in \
         task.prerequisites()])
     if prerequisiteIds:            
         node.setAttribute('prerequisites', prerequisiteIds)
     if task.shouldMarkCompletedWhenAllChildrenCompleted() != None:
         node.setAttribute('shouldMarkCompletedWhenAllChildrenCompleted', 
                           str(task.shouldMarkCompletedWhenAllChildrenCompleted()))
     for effort in task.efforts():
         node.appendChild(self.effortNode(effort))
     for eachNote in task.notes():
         node.appendChild(self.noteNode(eachNote))
     for attachment in task.attachments():
         node.appendChild(self.attachmentNode(attachment))
     return node
Пример #3
0
 def taskNode(self, task):  # pylint: disable-msg=W0621
     node = self.baseCompositeNode(task, "task", self.taskNode)
     node.setAttribute("status", str(task.getStatus()))
     if task.startDateTime() != date.DateTime():
         node.setAttribute("startdate", str(task.startDateTime()))
     if task.dueDateTime() != date.DateTime():
         node.setAttribute("duedate", str(task.dueDateTime()))
     if task.completionDateTime() != date.DateTime():
         node.setAttribute("completiondate", str(task.completionDateTime()))
     if task.percentageComplete() != 0:
         node.setAttribute("percentageComplete", str(task.percentageComplete()))
     if task.recurrence():
         node.appendChild(self.recurrenceNode(task.recurrence()))
     if task.budget() != date.TimeDelta():
         node.setAttribute("budget", self.budgetAsAttribute(task.budget()))
     if task.priority() != 0:
         node.setAttribute("priority", str(task.priority()))
     if task.hourlyFee() != 0:
         node.setAttribute("hourlyFee", str(task.hourlyFee()))
     if task.fixedFee() != 0:
         node.setAttribute("fixedFee", str(task.fixedFee()))
     if task.reminder() != None:
         node.setAttribute("reminder", str(task.reminder()))
     prerequisiteIds = " ".join([prerequisite.id() for prerequisite in task.prerequisites()])
     if prerequisiteIds:
         node.setAttribute("prerequisites", prerequisiteIds)
     if task.shouldMarkCompletedWhenAllChildrenCompleted() != None:
         node.setAttribute(
             "shouldMarkCompletedWhenAllChildrenCompleted", str(task.shouldMarkCompletedWhenAllChildrenCompleted())
         )
     for effort in task.efforts():
         node.appendChild(self.effortNode(effort))
     for eachNote in task.notes():
         node.appendChild(self.noteNode(eachNote))
     for attachment in task.attachments():
         node.appendChild(self.attachmentNode(attachment))
     return node
Пример #4
0
 def renderStartDateTime(task):
     # The rendering of the start date time doesn't depend on whether the
     # task is collapsed since the start date time is a parent is always <=
     # start date times of all children. 
     return render.dateTime(task.startDateTime())
Пример #5
0
 def children(self, recursive=False):
     children = super(TimelineRootNode, self).children(recursive)
     children.sort(key=lambda task: task.startDateTime())
     return children