Beispiel #1
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()
Beispiel #2
0
 def _createColumns(self):
     return [widgets.Column(_('Subject'), 'task.subject', 'task.completionDate',
             'task.dueDate', 'task.startDate',
             'task.track.start', 'task.track.stop', sortKey='subject', 
             sortCallback=self.uiCommands['viewsortbysubject'], 
             imageIndexCallback=self.subjectImageIndex,
             renderCallback=self.renderSubject)] + \
         [widgets.Column('', 'task.attachment.add', 
             'task.attachment.remove', width=28,
             alignment=wx.LIST_FORMAT_LEFT,
             visibilitySetting=('view', 'attachments'), 
             imageIndexCallback=self.attachmentImageIndex,
             headerImageIndex=self.imageIndex['attachment'],
             renderCallback=lambda task: '')] + \
         [widgets.Column(_('Categories'), 'task.category.add', 
             'task.category.remove', sortKey='categories',
             sortCallback=self.uiCommands['viewsortbycategories'],
             visibilitySetting=('view', 'categories'),
             renderCallback=self.renderCategory)] + \
         [widgets.Column(columnHeader, eventType,
          visibilitySetting=('view', setting.lower()), sortKey=setting, 
          sortCallback=self.uiCommands['viewsortby' + setting.lower()],
          renderCallback=renderCallback, alignment=wx.LIST_FORMAT_RIGHT) \
          for columnHeader, eventType, setting, renderCallback in \
         (_('Start date'), 'task.startDate', 'startDate', lambda task: render.date(task.startDate())),
         (_('Due date'), 'task.dueDate', 'dueDate', lambda task: render.date(task.dueDate())),
         (_('Days left'), 'task.timeLeft', 'timeLeft', lambda task: render.daysLeft(task.timeLeft())),
         (_('Completion date'), 'task.completionDate', 'completionDate', lambda task: render.date(task.completionDate())),
         (_('Budget'), 'task.budget', 'budget', lambda task: render.budget(task.budget())),
         (_('Total budget'), 'task.totalBudget', 'totalbudget', lambda task: render.budget(task.budget(recursive=True))),
         (_('Time spent'), 'task.timeSpent', 'timeSpent', lambda task: render.timeSpent(task.timeSpent())),
         (_('Total time spent'), 'task.totalTimeSpent', 'totaltimeSpent', lambda task: render.timeSpent(task.timeSpent(recursive=True))),
         (_('Budget left'), 'task.budgetLeft', 'budgetLeft', lambda task: render.budget(task.budgetLeft())),
         (_('Total budget left'), 'task.totalBudgetLeft', 'totalbudgetLeft', lambda task: render.budget(task.budgetLeft(recursive=True))),
         (_('Priority'), 'task.priority', 'priority', lambda task: render.priority(task.priority())),
         (_('Overall priority'), 'task.totalPriority', 'totalpriority', lambda task: render.priority(task.priority(recursive=True))),
         (_('Hourly fee'), 'task.hourlyFee', 'hourlyFee', lambda task: render.amount(task.hourlyFee())),
         (_('Fixed fee'), 'task.fixedFee', 'fixedFee', lambda task: render.amount(task.fixedFee())),
         (_('Total fixed fee'), 'task.totalFixedFee', 'totalfixedfee', lambda task: render.amount(task.fixedFee(recursive=True))),
         (_('Revenue'), 'task.revenue', 'revenue', lambda task: render.amount(task.revenue())),
         (_('Total revenue'), 'task.totalRevenue', 'totalrevenue', lambda task: render.amount(task.revenue(recursive=True))),
         (_('Last modification time'), 'task.lastModificationTime', 'lastModificationTime', lambda task: render.dateTime(task.lastModificationTime())),
         (_('Overall last modification time'),
         'task.totalLastModificationTime', 'totallastModificationTime', lambda task: render.dateTime(task.lastModificationTime(recursive=True)))]