comparison 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
comparison
equal deleted inserted replaced
44:f10126519797 45:780bfda9c583
18 from getan.view import * 18 from getan.view import *
19 from getan.utils import format_time 19 from getan.utils import format_time
20 20
21 logger = logging.getLogger() 21 logger = logging.getLogger()
22 22
23 def order_projects(projects):
24 projects = sorted(projects, key=lambda proj: proj.key)
25 ordered = {}
26 for p in projects:
27 c = p.key[0]
28 if c in ordered:
29 ordered[c].add_child(p.key[1:], p)
30 else:
31 ordered[c] = p
32 return ordered
33
34
23 class GetanController: 35 class GetanController:
24 def __init__(self, backend, pv_class, ev_class): 36 def __init__(self, backend, pv_class, ev_class):
25 self.ev_class = ev_class 37 self.ev_class = ev_class
26 self.pv_class = pv_class 38 self.pv_class = pv_class
27 39
31 else: 43 else:
32 entries = [] 44 entries = []
33 self.running = [] 45 self.running = []
34 46
35 self.backend = backend 47 self.backend = backend
36 self.project_view = pv_class(self, self.projects) 48 self.project_view = pv_class(self, order_projects(self.projects))
37 self.entries_view = ev_class(entries) 49 self.entries_view = ev_class(entries)
38 50
39 self.view = GetanView(self, self.project_view, self.entries_view) 51 self.view = GetanView(self, self.project_view, self.entries_view)
40 self.state = PausedProjectsState(self, self.project_view) 52 self.state = PausedProjectsState(self, self.project_view)
41 53
This site is hosted by Intevation GmbH (Datenschutzerklärung und Impressum | Privacy Policy and Imprint)