changeset 88:6dc52940dde0

Move 'up' and 'down' keypress handling to general ProjectState class
author Björn Ricks <bjoern.ricks@intevation.de>
date Mon, 30 May 2011 15:42:15 +0200
parents 0e5b6826a4ef
children 3bea335c0f30
files ChangeLog getan/states.py
diffstat 2 files changed, 21 insertions(+), 15 deletions(-) [+]
line wrap: on
line diff
--- a/ChangeLog	Mon May 30 15:38:35 2011 +0200
+++ b/ChangeLog	Mon May 30 15:42:15 2011 +0200
@@ -1,3 +1,9 @@
+2011-05-30	Björn Ricks <bjoern.ricks@intevation.de>
+
+	* getan/states.py: Move 'up' and 'down' keypress handling to
+	general ProjectState class to make them available in all project
+	states.
+
 2011-05-30	Björn Ricks <bjoern.ricks@intevation.de>
 
 	* getan/states.py: Use footer of EntryList to display
--- a/getan/states.py	Mon May 30 15:38:35 2011 +0200
+++ b/getan/states.py	Mon May 30 15:42:15 2011 +0200
@@ -44,6 +44,21 @@
             return DefaultEntryListState(self, self.controller,
                                   self.controller.entries_view)
 
+        if 'up' in key:
+            return self.up()
+
+        if 'down' in key:
+            return self.down()
+
+    def up(self):
+        self.view.up()
+        self.controller.update_entries(self.view.item_in_focus())
+        return self
+
+    def down(self):
+        self.view.down()
+        self.controller.update_entries(self.view.item_in_focus())
+        return self
 
 class PausedProjectsState(ProjectState):
     messages = {
@@ -56,12 +71,6 @@
         if ret:
             return ret
 
-        if 'up' in key:
-            return self.up()
-
-        if 'down' in key:
-            return self.down()
-
         if 'enter' in key:
             return self.select()
 
@@ -82,15 +91,6 @@
                     return RunningProjectsState(self.controller, self.view)
         return self
 
-    def up(self):
-        self.view.up()
-        self.controller.update_entries(self.view.item_in_focus())
-        return self
-
-    def down(self):
-        self.view.down()
-        self.controller.update_entries(self.view.item_in_focus())
-        return self
 
     def select(self):
         self.controller.start_project(self.view.item_in_focus())
This site is hosted by Intevation GmbH (Datenschutzerklärung und Impressum | Privacy Policy and Imprint)