示例#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()
示例#2
0
 def __init__(self, parent, timeDelta=defaultTimeDelta, readonly=False, 
              *args, **kwargs):
     super(TimeDeltaEntry, self).__init__(parent, *args, **kwargs)
     if readonly:
         self._entry = wx.StaticText(self, label=render.timeSpent(timeDelta))
     else:
         self._entry = masked.TextCtrl(self, mask='#{6}:##:##',
             formatcodes='RrFS')
         hours, minutes, seconds = timeDelta.hoursMinutesSeconds()
         self._entry.SetFieldParameters(0, defaultValue='%6d'%hours)
         self._entry.SetFieldParameters(1, defaultValue='%02d'%minutes)
         self._entry.SetFieldParameters(2, defaultValue='%02d'%seconds)
     self.add(self._entry, flag=wx.EXPAND|wx.ALL, proportion=1)
     self.fit()