def _addDefaultTreeItems(self, tree): self._allTasksItem = FilterTreeWidgetItem(None, ['All'], AllTasksFilter(), getIcon('FilterAll.png')) self._incompleteTasksItem = FilterTreeWidgetItem( None, ['Pending'], IncompleteTasksFilter(), getIcon('FilterPending.png')) self._dueItem = FilterTreeWidgetItem(None, ['Due'], HasDueDateFilter(), getIcon('FilterDue.png')) self._uncategorizedTasksItem = FilterTreeWidgetItem( None, ['Uncategorized'], UncategorizedTasksFilter(), getIcon('FilterUncategorized.png')) self._contextsItem = FilterTreeWidgetItem( None, ['Contexts'], HasContextsFilter(), getIcon('FilterContexts.png')) self._projectsItem = FilterTreeWidgetItem( None, ['Projects'], HasProjectsFilter(), getIcon('FilterProjects.png')) self._completeTasksItem = FilterTreeWidgetItem( None, ['Complete'], CompleteTasksFilter(), getIcon('FilterComplete.png')) tree.addTopLevelItems([ self._allTasksItem, self._incompleteTasksItem, self._uncategorizedTasksItem, self._dueItem, self._contextsItem, self._projectsItem, self._completeTasksItem ])
def _applyFilters(self, filters=None, searchText=None): # First we filter with filters tree if filters is None: filters = self._filters_tree_controller.view.getSelectedFilters() tasks = tasklib.filterTasks(filters, self._file.tasks) # Then with our search text if searchText is None: searchText = self.view.tasks_view.tasks_search_view.getSearchText() tasks = tasklib.filterTasks([SimpleTextFilter(searchText)], tasks) # with future filter if needed if not self.showFutureAction.isChecked(): tasks = tasklib.filterTasks([FutureFilter()], tasks) # with complete filter if needed if not CompleteTasksFilter() in filters and not self.showCompletedAction.isChecked(): tasks = tasklib.filterTasks([IncompleteTasksFilter()], tasks) self._tasks_list_controller.showTasks(tasks)
def _addDefaultTreeItems(self, tree): self._incompleteTasksItem = \ FilterTreeWidgetItem(None, ['Pending'], IncompleteTasksFilter(), getIcon('time.png')) self._dueItem = \ FilterTreeWidgetItem(None, ['Due'], HasDueDateFilter(), getIcon('due.png')) self._uncategorizedTasksItem = \ FilterTreeWidgetItem(None, ['Uncategorized'], UncategorizedTasksFilter(), getIcon('help.png')) self._contextsItem = \ FilterTreeWidgetItem(None, ['Contexts'], HasContextsFilter(), getIcon('at.png')) self._projectsItem = \ FilterTreeWidgetItem(None, ['Projects'], HasProjectsFilter(), getIcon('plus.png')) self._completeTasksItem = \ FilterTreeWidgetItem(None, ['Complete'], CompleteTasksFilter(), getIcon('x.png')) tree.addTopLevelItems([ self._incompleteTasksItem, self._dueItem, self._uncategorizedTasksItem, self._contextsItem, self._projectsItem, self._completeTasksItem ])
def selectAllTasksFilter(self): self.selectedFilters = [IncompleteTasksFilter()]