Пример #1
0
    def getAllDueRanges(self, return_completed=False):
        dueRanges = dict()
        # This determines the sorting of the ranges in the tree view. Lowest value first.
        rangeSorting = {
            'Today': 20,
            'Tomorrow': 30,
            'This week': 40,
            'This month': 50,
            'Overdue': 10
        }

        for task in self.tasks:
            if not return_completed and task.is_complete:
                continue

            count = 0 if task.is_complete else 1
            if DueTodayFilter('Today').isMatch(task):
                if not ('Today' in dueRanges):
                    dueRanges['Today'] = count
                else:
                    dueRanges['Today'] += count

            if DueTomorrowFilter('Tomorrow').isMatch(task):
                if not ('Tomorrow' in dueRanges):
                    dueRanges['Tomorrow'] = count
                else:
                    dueRanges['Tomorrow'] += count

            if DueThisWeekFilter('This week').isMatch(task):
                if not ('This week' in dueRanges):
                    dueRanges['This week'] = count
                else:
                    dueRanges['This week'] += count

            if DueThisMonthFilter('This month').isMatch(task):
                if not ('This month' in dueRanges):
                    dueRanges['This month'] = count
                else:
                    dueRanges['This month'] += count

            if DueOverdueFilter('Overdue').isMatch(task):
                if not ('Overdue' in dueRanges):
                    dueRanges['Overdue'] = count
                else:
                    dueRanges['Overdue'] += count

        return dueRanges, rangeSorting
Пример #2
0
    def getAllDueRanges(self):
        dueRanges = dict()
        # This determines the sorting of the ranges in the tree view. Lowest value first.
        rangeSorting = {
            'Today': 20,
            'Tomorrow': 30,
            'This week': 40,
            'This month': 50,
            'Overdue': 10
        }

        for task in self.tasks:
            if DueTodayFilter('Today').isMatch(task):
                if not ('Today' in dueRanges):
                    dueRanges['Today'] = 1
                else:
                    dueRanges['Today'] += 1

            if DueTomorrowFilter('Tomorrow').isMatch(task):
                if not ('Tomorrow' in dueRanges):
                    dueRanges['Tomorrow'] = 1
                else:
                    dueRanges['Tomorrow'] += 1

            if DueThisWeekFilter('This week').isMatch(task):
                if not ('This week' in dueRanges):
                    dueRanges['This week'] = 1
                else:
                    dueRanges['This week'] += 1

            if DueThisMonthFilter('This month').isMatch(task):
                if not ('This month' in dueRanges):
                    dueRanges['This month'] = 1
                else:
                    dueRanges['This month'] += 1

            if DueOverdueFilter('Overdue').isMatch(task):
                if not ('Overdue' in dueRanges):
                    dueRanges['Overdue'] = 1
                else:
                    dueRanges['Overdue'] += 1

        return dueRanges, rangeSorting
Пример #3
0
    def _addAllDueRanges(self, file, show_completed):

        dueRanges, rangeSorting = file.getAllDueRanges(show_completed)

        for range, number in dueRanges.items():
            if range == 'Today':
                filter = DueTodayFilter(range)
                sortKey = rangeSorting['Today']
            elif range == 'Tomorrow':
                filter = DueTomorrowFilter(range)
                sortKey = rangeSorting['Tomorrow']
            elif range == 'This week':
                filter = DueThisWeekFilter(range)
                sortKey = rangeSorting['This week']
            elif range == 'This month':
                filter = DueThisMonthFilter(range)
                sortKey = rangeSorting['This month']
            elif range == 'Overdue':
                filter = DueOverdueFilter(range)
                sortKey = rangeSorting['Overdue']

            self.view.addDueRangeFilter(filter, number, sortKey)