Adding a predefined sort to the tasks
authorEd Page <epage@Dulcinea.(none)>
Thu, 16 Apr 2009 02:55:36 +0000 (21:55 -0500)
committerEd Page <epage@Dulcinea.(none)>
Thu, 16 Apr 2009 02:55:36 +0000 (21:55 -0500)
src/rtm_view.py

index efdf60a..7c38370 100644 (file)
@@ -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