Пример #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, amount=0.0, readonly=False, *args, **kwargs):
     super(AmountEntry, self).__init__(parent, *args, **kwargs)
     if readonly:
         self._entry = wx.StaticText(self, label=render.amount(amount))
     else:
         self._entry = masked.NumCtrl(self, fractionWidth=2, 
                                      allowNegative=False, value=amount)
     self.add(self._entry)
     self.fit()