[Getan-commits] [PATCH 13 of 32] Also don't use item_in_focus when adding a entry description

Wald Commits scm-commit at wald.intevation.org
Fri Oct 11 14:33:57 CEST 2013


# HG changeset patch
# User Björn Ricks <bjoern.ricks at intevation.de>
# Date 1381482422 -7200
# Node ID a7ece2df59a2f04aeac951813f2f122b98197732
# Parent  b97d18d58f85efb1074797631fb3ca0c903154d7
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.

diff -r b97d18d58f85 -r a7ece2df59a2 getan/states.py
--- 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)


More information about the Getan-commits mailing list