Beispiel #1
0
 def _createColumns(self):
     kwargs = dict(renderDescriptionCallback=lambda task: task.description(),
                   resizeCallback=self.onResizeColumn)
     columns = [widgets.Column('subject', _('Subject'), 
             task.Task.subjectChangedEventType(), 
             'task.completionDate', 'task.dueDate', 'task.startDate',
             task.Task.trackStartEventType(), task.Task.trackStopEventType(), 
             sortCallback=uicommand.ViewerSortByCommand(viewer=self,
                 value='subject'),
             width=self.getColumnWidth('subject'), 
             imageIndexCallback=self.subjectImageIndex,
             renderCallback=self.renderSubject, **kwargs)] + \
         [widgets.Column('description', _('Description'), 
             task.Task.descriptionChangedEventType(), 
             sortCallback=uicommand.ViewerSortByCommand(viewer=self,
                 value='description'),
             renderCallback=lambda task: task.description(), 
             width=self.getColumnWidth('description'), **kwargs)] + \
         [widgets.Column('attachments', '', 
             task.Task.attachmentsChangedEventType(),
             width=self.getColumnWidth('attachments'),
             alignment=wx.LIST_FORMAT_LEFT,
             imageIndexCallback=self.attachmentImageIndex,
             headerImageIndex=self.imageIndex['attachment'],
             renderCallback=lambda task: '', **kwargs)]
     if self.settings.getboolean('feature', 'notes'):
         columns.append(widgets.Column('notes', '', 
             task.Task.notesChangedEventType(),
             width=self.getColumnWidth('notes'),
             alignment=wx.LIST_FORMAT_LEFT,
             imageIndexCallback=self.noteImageIndex,
             headerImageIndex=self.imageIndex['note'],
             renderCallback=lambda task: '', **kwargs))
     columns.extend(
         [widgets.Column('categories', _('Categories'), 
             task.Task.categoryAddedEventType(), 
             task.Task.categoryRemovedEventType(), 
             task.Task.categorySubjectChangedEventType(),
             sortCallback=uicommand.ViewerSortByCommand(viewer=self,
                                                        value='categories'),
             width=self.getColumnWidth('categories'),
             renderCallback=self.renderCategory, **kwargs)] + \
         [widgets.Column('totalCategories', _('Overall categories'),
             task.Task.totalCategoryAddedEventType(),
             task.Task.totalCategoryRemovedEventType(),
             task.Task.totalCategorySubjectChangedEventType(),
             sortCallback=uicommand.ViewerSortByCommand(viewer=self,
                                                        value='totalCategories'),
             renderCallback=lambda task: self.renderCategory(task, recursive=True),
             width=self.getColumnWidth('totalCategories'), **kwargs)])
     effortOn = self.settings.getboolean('feature', 'effort')
     dependsOnEffortFeature = ['budget', 'totalBudget', 
                               'timeSpent', 'totalTimeSpent', 
                               'budgetLeft', 'totalBudgetLeft',
                               'hourlyFee', 'fixedFee', 'totalFixedFee',
                               'revenue', 'totalRevenue']
     for name, columnHeader, renderCallback, eventType in [
         ('startDate', _('Start date'), lambda task: render.date(task.startDate()), None),
         ('dueDate', _('Due date'), lambda task: render.date(task.dueDate()), None),
         ('timeLeft', _('Days left'), lambda task: render.daysLeft(task.timeLeft(), task.completed()), None),
         ('completionDate', _('Completion date'), lambda task: render.date(task.completionDate()), None),
         ('recurrence', _('Recurrence'), lambda task: render.recurrence(task.recurrence()), None),
         ('budget', _('Budget'), lambda task: render.budget(task.budget()), None),
         ('totalBudget', _('Total budget'), lambda task: render.budget(task.budget(recursive=True)), None),
         ('timeSpent', _('Time spent'), lambda task: render.timeSpent(task.timeSpent()), None),
         ('totalTimeSpent', _('Total time spent'), lambda task: render.timeSpent(task.timeSpent(recursive=True)), None),
         ('budgetLeft', _('Budget left'), lambda task: render.budget(task.budgetLeft()), None),
         ('totalBudgetLeft', _('Total budget left'), lambda task: render.budget(task.budgetLeft(recursive=True)), None),
         ('priority', _('Priority'), lambda task: render.priority(task.priority()), None),
         ('totalPriority', _('Overall priority'), lambda task: render.priority(task.priority(recursive=True)), None),
         ('hourlyFee', _('Hourly fee'), lambda task: render.amount(task.hourlyFee()), task.Task.hourlyFeeChangedEventType()),
         ('fixedFee', _('Fixed fee'), lambda task: render.amount(task.fixedFee()), None),
         ('totalFixedFee', _('Total fixed fee'), lambda task: render.amount(task.fixedFee(recursive=True)), None),
         ('revenue', _('Revenue'), lambda task: render.amount(task.revenue()), None),
         ('totalRevenue', _('Total revenue'), lambda task: render.amount(task.revenue(recursive=True)), None),
         ('reminder', _('Reminder'), lambda task: render.dateTime(task.reminder()), None)]:
         eventType = eventType or 'task.'+name
         if (name in dependsOnEffortFeature and effortOn) or name not in dependsOnEffortFeature:
             columns.append(widgets.Column(name, columnHeader, eventType, 
                 sortCallback=uicommand.ViewerSortByCommand(viewer=self, value=name),
                 renderCallback=renderCallback, width=self.getColumnWidth(name),
                 alignment=wx.LIST_FORMAT_RIGHT, **kwargs))
     return columns
Beispiel #2
0
 def testThreeMonthly(self):
     self.assertEqual('Every 3 months', 
                      render.recurrence(date.Recurrence('monthly', 3))) 
Beispiel #3
0
 def testThreeYearly(self):
     self.assertEqual('Every 3 years', 
                      render.recurrence(date.Recurrence('yearly', 3)))
Beispiel #4
0
 def testThreeDaily(self):
     self.assertEqual('Every 3 days', 
                      render.recurrence(date.Recurrence('daily', amount=3))) 
Beispiel #5
0
 def testThreeWeekly(self):
     self.assertEqual('Every 3 weeks', 
                      render.recurrence(date.Recurrence('weekly', amount=3))) 
Beispiel #6
0
 def testEveryOtherMonth(self):
     self.assertEqual(_('Every other month'), 
                      render.recurrence(date.Recurrence('monthly', amount=2)))
Beispiel #7
0
 def testEveryOtherYear(self):
     self.assertEqual(_('Every other year'), 
                      render.recurrence(date.Recurrence('yearly', amount=2)))
Beispiel #8
0
 def testEveryOtherDay(self):
     self.assertEqual(_('Every other day'), 
                      render.recurrence(date.Recurrence('daily', amount=2)))
Beispiel #9
0
 def testEveryOtherWeek(self):
     self.assertEqual(_('Every other week'), 
                      render.recurrence(date.Recurrence('weekly', amount=2)))
Beispiel #10
0
 def testYearlyRecurrence(self):
     self.assertEqual(_('Yearly'), render.recurrence(date.Recurrence('yearly')))
Beispiel #11
0
 def testMonthlyRecurrence(self):
     self.assertEqual(_('Monthly'), render.recurrence(date.Recurrence('monthly')))
Beispiel #12
0
 def testWeeklyRecurrence(self):
     self.assertEqual(_('Weekly'), render.recurrence(date.Recurrence('weekly')))
Beispiel #13
0
 def testDailyRecurrence(self):
     self.assertEqual(_('Daily'), render.recurrence(date.Recurrence('daily')))
Beispiel #14
0
 def testNoRecurrence(self):
     self.assertEqual('', render.recurrence(date.Recurrence()))