[Getan-commits] [PATCH 08 of 32] Set focus to project list body when changing from adding and subtracting time

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


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

diff -r f21c1fe3b20b -r c75eed90ae01 getan/states.py
--- 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
 


More information about the Getan-commits mailing list