Example #1
0
 def __init__(self, parent, task, *args, **kwargs):
     super(DatesPage, self).__init__(parent, task, *args, **kwargs)
     datesBox = widgets.BoxWithFlexGridSizer(self, label=_('Dates'), cols=3)
     self.addHeaders(datesBox)
     for label, taskMethodName in [(_('Start date'), 'startDate'), 
                                   (_('Due date'), 'dueDate'),
                                   (_('Completion date'), 'completionDate')]:
         datesBox.add(label)
         taskMethod = getattr(task, taskMethodName)
         entry = DateEntry(datesBox, taskMethod())
         setattr(self, '_%sEntry'%taskMethodName, entry)
         datesBox.add(entry)
         if task.children():
             recursiveEntry = DateEntry(datesBox, 
                 taskMethod(recursive=True), readonly=True)
         else:
             recursiveEntry = (0, 0)
         datesBox.add(recursiveEntry)
     
     reminderBox = widgets.BoxWithFlexGridSizer(self, label=_('Reminder'), 
         cols=2)
     reminderBox.add(_('Reminder'))
     self._reminderDateTimeEntry = widgets.DateTimeCtrl(reminderBox, 
         task.reminder())
     reminderBox.add(self._reminderDateTimeEntry)
     for box in datesBox, reminderBox:
         box.fit()
         self.add(box, proportion=1, flag=wx.EXPAND|wx.ALL, border=5)
     self.fit()
Example #2
0
 def __init__(self, parent, task, *args, **kwargs):
     super(BudgetPage, self).__init__(parent, task, *args, **kwargs)
     # Boxes:
     budgetBox = widgets.BoxWithFlexGridSizer(self, label=_('Budget'), cols=3)
     revenueBox = widgets.BoxWithFlexGridSizer(self, label=_('Revenue'), cols=3)
     # Editable entries:
     self._budgetEntry = TimeDeltaEntry(budgetBox, task.budget())
     self._hourlyFeeEntry = AmountEntry(revenueBox, task.hourlyFee())
     self._fixedFeeEntry = AmountEntry(revenueBox, task.fixedFee())
     # Readonly entries:
     if task.children():
         recursiveBudget = render.budget(task.budget(recursive=True))
         recursiveTimeSpent = render.timeSpent(task.timeSpent(recursive=True))
         recursiveBudgetLeft = render.budget(task.budgetLeft(recursive=True))
         recursiveFixedFee = render.amount(task.fixedFee(recursive=True))
         recursiveRevenue = render.amount(task.revenue(recursive=True))
     else:
         recursiveBudget = recursiveTimeSpent = recursiveBudgetLeft = \
         recursiveFixedFee = recursiveRevenue = ''
     # Fill the boxes:
     self.addHeaders(budgetBox)
     for entry in [_('Budget'), self._budgetEntry, recursiveBudget,
                   _('Time spent'), render.budget(task.timeSpent()), recursiveTimeSpent,
                   _('Budget left'), render.budget(task.budgetLeft()), recursiveBudgetLeft]:
         budgetBox.add(entry, flag=wx.ALIGN_RIGHT)
     
     self.addHeaders(revenueBox)
     for entry in [_('Hourly fee'), self._hourlyFeeEntry, '',
                   _('Fixed fee'), self._fixedFeeEntry, recursiveFixedFee,
                   _('Revenue'), render.amount(task.revenue()), recursiveRevenue]:
         revenueBox.add(entry, flag=wx.ALIGN_RIGHT)
     for box in budgetBox, revenueBox:
         box.fit()
         self.add(box, proportion=1, flag=wx.EXPAND|wx.ALL, border=5)
     self.fit()
Example #3
0
 def getImageIndices(self, task):
     bitmap = 'task'
     if task.children():
         bitmap += 's'
     if task.completed():
         bitmap += '_completed'
     elif task.overdue():
         bitmap += '_overdue'
     elif task.dueToday():
         bitmap += '_duetoday'
     elif task.inactive():
         bitmap += '_inactive'
     if task.children():
         bitmap_selected = bitmap + '_open'
     else:
         bitmap_selected = bitmap
     if task.isBeingTracked():
         bitmap = bitmap_selected = 'start'
     return self.imageIndex[bitmap], self.imageIndex[bitmap_selected]
Example #4
0
 def read(self):
     domDocument = xml.dom.minidom.parse(self.__fd)
     self.__tskversion = self.__parseTskVersionNumber(domDocument)
     tasks = self.__parseTaskNodes(domDocument.documentElement.childNodes)
     tasksAndAllChildren = tasks[:]
     for task in tasks:
         tasksAndAllChildren.extend(task.children(recursive=True))
     tasksById = dict([(task.id(), task) for task in tasksAndAllChildren])
     if self.__tskversion <= 13:
         categories = self.__parseCategoryNodesFromTaskNodes(domDocument, 
                                                             tasksById)
     else:
         categories = self.__parseCategoryNodes( \
             domDocument.documentElement.childNodes, tasksById)
     return tasks, categories
Example #5
0
 def addTaskRecursively(task, parentItem=None):
     item = self._taskEntry.Append(task.subject(), 
         parent=parentItem, clientData=task)
     for child in task.children():
         addTaskRecursively(child, item)