changeset 303:c75eed90ae01

Set focus to project list body when changing from adding and subtracting time back to the old state This alows to use keys to navigate throught the list again after adding or subtracting time from the running project.
author Björn Ricks <bjoern.ricks@intevation.de>
date Fri, 11 Oct 2013 10:13:40 +0200
parents f21c1fe3b20b
children c7f9997a5492
files getan/states.py
diffstat 1 files changed, 9 insertions(+), 0 deletions(-) [+]
line wrap: on
line diff
--- a/getan/states.py	Fri Oct 11 10:08:57 2013 +0200
+++ b/getan/states.py	Fri Oct 11 10:13:40 2013 +0200
@@ -94,6 +94,7 @@
 
     def set_focus(self):
         self.controller.view.set_focus("projects")
+        self.view.frame.set_focus("body")
 
 
 class PausedProjectsState(ProjectState):
@@ -356,6 +357,8 @@
         raise Exception("Not implemented")
 
     def exit(self):
+        # restore old focus
+        self.state.set_focus()
         self.set_next_state(self.state)
         return True
 
@@ -394,6 +397,8 @@
         logger.info("AddTimeState: add %d minutes to project '%s'"
                     % (minutes, project.desc))
         self.view.show_total_time()
+        # set focus to the original element
+        self.state.set_focus()
         self.set_next_state(self.state)
         return True
 
@@ -405,6 +410,8 @@
         sec = minutes * 60
         if sec > self.state.sec:
             self.view.show_total_time()
+            # set focus to the original element
+            self.state.set_focus()
             self.set_next_state(self.state)
             return False
         project = self.project
@@ -413,6 +420,8 @@
         logger.info("SubtractTimeState: subtract %d minutes from project '%s'"
                     % (minutes, project.desc))
         self.view.show_total_time()
+        # set focus to the original element
+        self.state.set_focus()
         self.set_next_state(self.state)
         return True
 
This site is hosted by Intevation GmbH (Datenschutzerklärung und Impressum | Privacy Policy and Imprint)