Esempio n. 1
0
 def taskNode(self, task):
     node = self.baseCompositeNode(task, 'task', self.taskNode)
     node.setAttribute('status', str(task.getStatus()))
     if task.startDate() != date.Date():
         node.setAttribute('startdate', str(task.startDate()))
     if task.dueDate() != date.Date():
         node.setAttribute('duedate', str(task.dueDate()))
     if task.completionDate() != date.Date():
         node.setAttribute('completiondate', str(task.completionDate()))
     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()))
     if task.shouldMarkCompletedWhenAllChildrenCompleted != None:
         node.setAttribute('shouldMarkCompletedWhenAllChildrenCompleted', 
                           str(task.shouldMarkCompletedWhenAllChildrenCompleted))
     for effort in task.efforts():
         node.appendChild(self.effortNode(effort))
     for note in task.notes():
         node.appendChild(self.noteNode(note))
     for attachment in task.attachments():
         node.appendChild(self.attachmentNode(attachment))
     return node
Esempio n. 2
0
 def __composites_to_remove(self, task):  # pylint: disable=W0621
     efforts = task.efforts()
     task_and_ancestors = [task] + task.ancestors()
     composites_to_remove = []
     for effort in efforts:
         for task in task_and_ancestors:
             composites_to_remove.extend(self.__composite_to_remove(effort, task))
     return composites_to_remove
Esempio n. 3
0
 def compositesToRemove(self, task): # pylint: disable-msg=W0621
     efforts = task.efforts()
     taskAndAncestors = [task] + task.ancestors()
     compositesToRemove = []
     for effort in efforts:
         for task in taskAndAncestors:
             compositesToRemove.extend(self.compositeToRemove(effort, task))
     return compositesToRemove
Esempio n. 4
0
 def removeItemsFromSelf(self, tasks):
     ''' removeItemsFromSelf is called when an item is removed from the 
         observed list. The default behavior of removeItemsFromSelf is to 
         remove the item from the observing list (i.e. this list)
         unchanged. We override the default behavior to remove the 
         tasks' efforts from the CompositeEfforts they are part of. '''
     for task in tasks:
         self.removeComposites(task, task.efforts())
Esempio n. 5
0
 def removeItemsFromSelf(self, tasks, event=None):
     ''' removeItemsFromSelf is called when an item is removed from the 
         observed list. The default behavior of removeItemsFromSelf is to 
         remove the item from the observing list (i.e. this list)
         unchanged. We override the default behavior to remove the 
         tasks' efforts from the CompositeEfforts they are part of. '''
     for task in tasks:  # pylint: disable-msg=W0621
         self.removeComposites(task, task.efforts(), event=event)
Esempio n. 6
0
 def __composites_to_remove(self, task):  # pylint: disable=W0621
     efforts = task.efforts()
     task_and_ancestors = [task] + task.ancestors()
     composites_to_remove = []
     for effort in efforts:
         for task in task_and_ancestors:
             composites_to_remove.extend(
                 self.__composite_to_remove(effort, task))
     return composites_to_remove
Esempio n. 7
0
 def extendSelf(self, tasks, event=None):
     ''' extendSelf is called when an item is added to the observed
         list. The default behavior of extendSelf is to add the item
         to the observing list (i.e. this list) unchanged. We override 
         the default behavior to first get the efforts from the task
         and then group the efforts by time period. '''
     new_composites = []
     for task in tasks:  # pylint: disable=W0621
         new_composites.extend(self.__create_composites(task, task.efforts()))
     self.__extend_self_with_composites(new_composites, event=event)
Esempio n. 8
0
 def extendSelf(self, tasks):
     ''' extendSelf is called when an item is added to the observed
         list. The default behavior of extendSelf is to add the item
         to the observing list (i.e. this list) unchanged. We override 
         the default behavior to first get the efforts from the task
         and then group the efforts by time period. '''
     newComposites = []
     for task in tasks:
         newComposites.extend(self.createComposites(task, task.efforts()))
     super(EffortAggregator, self).extendSelf(newComposites)
Esempio n. 9
0
 def extendSelf(self, tasks, event=None):
     ''' extendSelf is called when an item is added to the observed
         list. The default behavior of extendSelf is to add the item
         to the observing list (i.e. this list) unchanged. We override 
         the default behavior to first get the efforts from the task
         and then group the efforts by time period. '''
     newComposites = []
     for task in tasks:  # pylint: disable-msg=W0621
         newComposites.extend(self.createComposites(task, task.efforts()))
     super(EffortAggregator, self).extendSelf(newComposites, event)
 def extendSelf(self, tasks, event=None):
     ''' This method is called when a task is added to the observed list.
         It overrides ObservableListObserver.extendSelf whose default 
         behaviour is to add the item that is added to the observed 
         list to the observing list (this list) unchanged. But we want to 
         add the efforts of the tasks, rather than the tasks themselves. '''
     effortsToAdd = []
     for task in tasks:
         effortsToAdd.extend(task.efforts())
     super(EffortList, self).extendSelf(effortsToAdd, event)
     for effort in effortsToAdd:
         if effort.getStop() is None:
             pub.sendMessage(effort.trackingChangedEventType(), newValue=True, sender=effort)
Esempio n. 11
0
 def extendSelf(self, tasks, event=None):
     ''' This method is called when a task is added to the observed list.
         It overrides ObservableListObserver.extendSelf whose default 
         behaviour is to add the item that is added to the observed 
         list to the observing list (this list) unchanged. But we want to 
         add the efforts of the tasks, rather than the tasks themselves. '''
     effortsToAdd = []
     for task in tasks:
         effortsToAdd.extend(task.efforts())
     super(EffortList, self).extendSelf(effortsToAdd, event)
     for effort in effortsToAdd:
         if effort.getStop() is None:
             pub.sendMessage(effort.trackingChangedEventType(), newValue=True, sender=effort)
Esempio n. 12
0
 def removeItemsFromSelf(self, tasks, event=None):
     ''' This method is called when a task is removed from the observed 
         list. It overrides ObservableListObserver.removeItemsFromSelf 
         whose default behaviour is to remove the item that was removed
         from the observed list from the observing list (this list) 
         unchanged. But we want to remove the efforts of the tasks, rather 
         than the tasks themselves. '''
     effortsToRemove = []
     for task in tasks:
         effortsToRemove.extend(task.efforts())
     for effort in effortsToRemove:
         if effort.getStop() is None:
             pub.sendMessage(effort.trackingChangedEventType(), newValue=False, sender=effort)
     super(EffortList, self).removeItemsFromSelf(effortsToRemove, event)
 def removeItemsFromSelf(self, tasks, event=None):
     ''' This method is called when a task is removed from the observed 
         list. It overrides ObservableListObserver.removeItemsFromSelf 
         whose default behaviour is to remove the item that was removed
         from the observed list from the observing list (this list) 
         unchanged. But we want to remove the efforts of the tasks, rather 
         than the tasks themselves. '''
     effortsToRemove = []
     for task in tasks:
         effortsToRemove.extend(task.efforts())
     for effort in effortsToRemove:
         if effort.getStop() is None:
             pub.sendMessage(effort.trackingChangedEventType(), newValue=False, sender=effort)
     super(EffortList, self).removeItemsFromSelf(effortsToRemove, event)
Esempio n. 14
0
 def taskNode(self, parentNode, task):  # pylint: disable=W0621
     maxDateTime = self.maxDateTime
     node = self.baseCompositeNode(parentNode, task, 'task', self.taskNode)
     node.attrib['status'] = str(task.getStatus())
     if task.plannedStartDateTime() != maxDateTime:
         node.attrib['plannedstartdate'] = str(task.plannedStartDateTime())
     if task.dueDateTime() != maxDateTime:
         node.attrib['duedate'] = str(task.dueDateTime())
     if task.actualStartDateTime() != maxDateTime:
         node.attrib['actualstartdate'] = str(task.actualStartDateTime())
     if task.completionDateTime() != maxDateTime:
         node.attrib['completiondate'] = str(task.completionDateTime())
     if task.percentageComplete():
         node.attrib['percentageComplete'] = str(task.percentageComplete())
     if task.recurrence():
         self.recurrenceNode(node, task.recurrence())
     if task.budget() != date.TimeDelta():
         node.attrib['budget'] = self.budgetAsAttribute(task.budget())
     if task.priority():
         node.attrib['priority'] = str(task.priority())
     if task.hourlyFee():
         node.attrib['hourlyFee'] = str(task.hourlyFee())
     if task.fixedFee():
         node.attrib['fixedFee'] = str(task.fixedFee())
     reminder = task.reminder() 
     if reminder != maxDateTime and reminder != None:
         node.attrib['reminder'] = str(reminder)
         reminderBeforeSnooze = task.reminder(includeSnooze=False)
         if reminderBeforeSnooze != None and reminderBeforeSnooze < task.reminder():
             node.attrib['reminderBeforeSnooze'] = str(reminderBeforeSnooze)
     prerequisiteIds = ' '.join([prerequisite.id() for prerequisite in \
         sortedById(task.prerequisites())])
     if prerequisiteIds:            
         node.attrib['prerequisites'] = prerequisiteIds
     if task.shouldMarkCompletedWhenAllChildrenCompleted() != None:
         node.attrib['shouldMarkCompletedWhenAllChildrenCompleted'] = \
                           str(task.shouldMarkCompletedWhenAllChildrenCompleted())
     for effort in sortedById(task.efforts()):
         self.effortNode(node, effort)
     for eachNote in sortedById(task.notes()):
         self.noteNode(node, eachNote)
     for attachment in sortedById(task.attachments()):
         self.attachmentNode(node, attachment)
     return node
Esempio n. 15
0
 def taskNode(self, parentNode, task):  # pylint: disable=W0621
     maxDateTime = self.maxDateTime
     node = self.baseCompositeNode(parentNode, task, 'task', self.taskNode)
     node.attrib['status'] = str(task.getStatus())
     if task.plannedStartDateTime() != maxDateTime:
         node.attrib['plannedstartdate'] = str(task.plannedStartDateTime())
     if task.dueDateTime() != maxDateTime:
         node.attrib['duedate'] = str(task.dueDateTime())
     if task.actualStartDateTime() != maxDateTime:
         node.attrib['actualstartdate'] = str(task.actualStartDateTime())
     if task.completionDateTime() != maxDateTime:
         node.attrib['completiondate'] = str(task.completionDateTime())
     if task.percentageComplete():
         node.attrib['percentageComplete'] = str(task.percentageComplete())
     if task.recurrence():
         self.recurrenceNode(node, task.recurrence())
     if task.budget() != date.TimeDelta():
         node.attrib['budget'] = self.budgetAsAttribute(task.budget())
     if task.priority():
         node.attrib['priority'] = str(task.priority())
     if task.hourlyFee():
         node.attrib['hourlyFee'] = str(task.hourlyFee())
     if task.fixedFee():
         node.attrib['fixedFee'] = str(task.fixedFee())
     reminder = task.reminder() 
     if reminder != maxDateTime and reminder != None:
         node.attrib['reminder'] = str(reminder)
         reminderBeforeSnooze = task.reminder(includeSnooze=False)
         if reminderBeforeSnooze != None and reminderBeforeSnooze < task.reminder():
             node.attrib['reminderBeforeSnooze'] = str(reminderBeforeSnooze)
     prerequisiteIds = ' '.join([prerequisite.id() for prerequisite in \
         sortedById(task.prerequisites())])
     if prerequisiteIds:            
         node.attrib['prerequisites'] = prerequisiteIds
     if task.shouldMarkCompletedWhenAllChildrenCompleted() != None:
         node.attrib['shouldMarkCompletedWhenAllChildrenCompleted'] = \
                           str(task.shouldMarkCompletedWhenAllChildrenCompleted())
     for effort in sortedById(task.efforts()):
         self.effortNode(node, effort)
     for eachNote in sortedById(task.notes()):
         self.noteNode(node, eachNote)
     for attachment in sortedById(task.attachments()):
         self.attachmentNode(node, attachment)
     return node
Esempio n. 16
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
Esempio n. 17
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
Esempio n. 18
0
 def onTaskAddedOrRemoved(self, event):
     if any(task.efforts() for task in event.values()):
         self._invalidateCache()
         self.notifyObserversOfDurationOrEmpty()
Esempio n. 19
0
 def onTaskAddedOrRemoved(self, event):
     if any(task.efforts() for task in event.values()):
         self._invalidateCache()
         self.notifyObserversOfDurationOrEmpty()