diff getan.py @ 45:780bfda9c583 project-tree

Initialized a branch to work on a tree-like project view.
author Ingo Weinzierl <ingo.weinzierl@intevation.de>
date Tue, 21 Dec 2010 19:34:03 +0100
parents a5439795ef09
children
line wrap: on
line diff
--- a/getan.py	Wed Dec 15 14:47:40 2010 +0100
+++ b/getan.py	Tue Dec 21 19:34:03 2010 +0100
@@ -20,6 +20,18 @@
 
 logger = logging.getLogger()
 
+def order_projects(projects):
+    projects = sorted(projects, key=lambda proj: proj.key)
+    ordered  = {}
+    for p in projects:
+        c = p.key[0]
+        if c in ordered:
+            ordered[c].add_child(p.key[1:], p)
+        else:
+            ordered[c] = p
+    return ordered
+
+
 class GetanController:
     def __init__(self, backend, pv_class, ev_class):
         self.ev_class = ev_class
@@ -33,7 +45,7 @@
         self.running  = []
 
         self.backend      = backend
-        self.project_view = pv_class(self, self.projects)
+        self.project_view = pv_class(self, order_projects(self.projects))
         self.entries_view = ev_class(entries)
 
         self.view  = GetanView(self, self.project_view, self.entries_view)
This site is hosted by Intevation GmbH (Datenschutzerklärung und Impressum | Privacy Policy and Imprint)