changeset 318:27fc5f43a69b

Move setting the ProjectList and EntryList instances into the controller It doesn't make sense to pass classes for both to the GetanController constructor. Be don't have different implementations for these classes.
author Björn Ricks <bjoern.ricks@intevation.de>
date Fri, 11 Oct 2013 14:12:03 +0200
parents dc7c1a894e21
children ec84b522c94b
files getan/controller.py getan/main.py
diffstat 2 files changed, 5 insertions(+), 9 deletions(-) [+]
line wrap: on
line diff
--- a/getan/controller.py	Fri Oct 11 14:08:44 2013 +0200
+++ b/getan/controller.py	Fri Oct 11 14:12:03 2013 +0200
@@ -14,7 +14,7 @@
 
 from datetime import datetime
 
-from getan.view import GetanView
+from getan.view import GetanView, ProjectList, EntryList
 from getan.states import PausedProjectsState
 from getan.utils import format_time
 from getan.config import Config
@@ -24,10 +24,7 @@
 
 class GetanController(object):
 
-    def __init__(self, backend, pv_class, ev_class):
-        self.ev_class = ev_class
-        self.pv_class = pv_class
-
+    def __init__(self, backend):
         self.config = Config()
 
         self.backend = backend
@@ -36,8 +33,8 @@
         self.running = []
 
         self.view = None
-        self.entries_view = ev_class(entries)
-        self.project_view = pv_class(self, self.projects)
+        self.entries_view = EntryList(entries)
+        self.project_view = ProjectList(self, self.projects)
 
         self.view = GetanView(self, self.project_view, self.entries_view)
         self.state = PausedProjectsState(self, self.project_view)
--- a/getan/main.py	Fri Oct 11 14:08:44 2013 +0200
+++ b/getan/main.py	Fri Oct 11 14:12:03 2013 +0200
@@ -20,7 +20,6 @@
 import getan.config as config
 
 from getan.backend import DEFAULT_DATABASE, Backend
-from getan.view import ProjectList, EntryList
 from getan.controller import GetanController
 
 logger = logging.getLogger()
@@ -61,7 +60,7 @@
         backend = Backend(database)
         logging.info("Use database '%s'." % database)
 
-    controller = GetanController(backend, ProjectList, EntryList)
+    controller = GetanController(backend)
 
     try:
         controller.main()
This site is hosted by Intevation GmbH (Datenschutzerklärung und Impressum | Privacy Policy and Imprint)