changeset 308:a7ece2df59a2

Also don't use item_in_focus when adding a entry description Pass the current running project direclty to the DescriptionProjectsState constructor to avoid using item_in_focus which may select the wrong project.
author Björn Ricks <bjoern.ricks@intevation.de>
date Fri, 11 Oct 2013 11:07:02 +0200
parents b97d18d58f85
children bff4877c3e58
files getan/states.py
diffstat 1 files changed, 9 insertions(+), 4 deletions(-) [+]
line wrap: on
line diff
--- a/getan/states.py	Fri Oct 11 11:05:22 2013 +0200
+++ b/getan/states.py	Fri Oct 11 11:07:02 2013 +0200
@@ -331,7 +331,8 @@
         self.set_next_state(
             DescriptionProjectsState(
                 self.controller, self.view,
-                self, self.controller.view.get_frame().get_footer()))
+                self, self.controller.view.get_frame().get_footer(),
+                self.project))
         return True
 
 
@@ -433,6 +434,11 @@
         'choose_proj': _(" Choose a project."),
     }
 
+    def __init__(self, controller, view, state, footer, project):
+        super(DescriptionProjectsState, self).__init__(controller, view, state,
+                                                       footer)
+        self.project = project
+
     def keypress(self, size, key):
         """ Direct key to frame of GetanView """
         self.controller.view.frame.keypress(size, key)
@@ -450,9 +456,8 @@
         return True
 
     def exit(self):
-        project = self.view.item_in_focus()
-        if project:
-            time = (datetime.now() - project.start).seconds
+        if self.project:
+            time = (datetime.now() - self.project.start).seconds
             self.state.sec = time
             signal.signal(signal.SIGALRM, self.state.handle_signal)
             signal.alarm(1)
This site is hosted by Intevation GmbH (Datenschutzerklärung und Impressum | Privacy Policy and Imprint)