def __init__(self, parent, task, *args, **kwargs): super(SubjectPage, self).__init__(parent, task, *args, **kwargs) descriptionBox = widgets.BoxWithFlexGridSizer(self, _('Description'), cols=2, growableRow=1, growableCol=1) descriptionBox.add(_('Subject')) self._subjectEntry = widgets.SingleLineTextCtrl(descriptionBox, task.subject()) descriptionBox.add(self._subjectEntry, proportion=1, flag=wx.EXPAND) descriptionBox.add(_('Description')) self._descriptionEntry = widgets.MultiLineTextCtrl(descriptionBox, task.description()) descriptionBox.add(self._descriptionEntry, proportion=1, flag=wx.EXPAND) priorityBox = widgets.BoxWithFlexGridSizer(self, _('Priority'), cols=2) priorityBox.add(_('Priority')) self._prioritySpinner = wx.SpinCtrl(priorityBox, value=render.priority(task.priority()), style=wx.SP_ARROW_KEYS) # Can't use sys.maxint because Python and wxPython disagree on what the # maximum integer is on Suse 10.0 x86_64. Using sys.maxint will cause # an Overflow exception, so we use a constant: maxint = 2147483647 self._prioritySpinner.SetRange(-maxint, maxint) priorityBox.add(self._prioritySpinner) for box, proportion in [(descriptionBox, 1), (priorityBox, 0)]: box.fit() self.add(box, proportion=proportion, flag=wx.EXPAND|wx.ALL, border=5) self.fit()
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)))]