From fb477b1d0d127d4854fb548010bfb3a8dd10036a Mon Sep 17 00:00:00 2001 From: Ed Page Date: Wed, 15 Apr 2009 21:55:36 -0500 Subject: [PATCH] Adding a predefined sort to the tasks --- src/rtm_view.py | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/src/rtm_view.py b/src/rtm_view.py index efdf60a..7c38370 100644 --- a/src/rtm_view.py +++ b/src/rtm_view.py @@ -283,7 +283,9 @@ class GtkRtMilk(object): # @todo Look into using a button for notes and links, and labels for all else currentProject = self._get_project() projId = self._manager.lookup_project(currentProject)["id"] - for taskDetails in self._manager.get_tasks_with_details(projId): + sortedTasks = list(self._manager.get_tasks_with_details(projId)) + sortedTasks.sort(key = lambda taskDetails: (taskDetails["priority"].get_nothrow(1000), taskDetails["dueDate"].get_nothrow(datetime.datetime.max))) + for taskDetails in sortedTasks: show = self._showCompleted if taskDetails["isCompleted"] else self._showIncomplete if not show: continue -- 1.7.9.5