changeset 104:36204a42bd79

Allow to select projects with keys > 1 letters while moving entries
author Björn Ricks <bjoern.ricks@intevation.de>
date Mon, 12 Sep 2011 14:32:20 +0200
parents 9546120437c7
children 4bf17975acca
files getan/states.py
diffstat 1 files changed, 15 insertions(+), 3 deletions(-) [+]
line wrap: on
line diff
--- a/getan/states.py	Mon Sep 12 14:08:09 2011 +0200
+++ b/getan/states.py	Mon Sep 12 14:32:20 2011 +0200
@@ -117,7 +117,6 @@
             return RunningProjectsState(self.controller, self.view, proj)
         return self
 
-
     def keypress(self, key):
         if 'esc' in key:
             self.reset()
@@ -459,6 +458,14 @@
     def __init__(self, state, controller, view):
         super(MoveEntryState, self).__init__(state, controller, view)
         self.view.set_footer_text(self.msg('project'), 'question')
+        self.proj_keys = ""
+
+    def set_project_footer(self):
+        self.controller.project_view.set_footer_text("Selecting project from " \
+           "key: %s" % self.proj_keys, "running")
+
+    def reset_project_footer(self):
+        self.controller.project_view.set_footer_text("", "entry_footer")
 
     def keypress(self, key):
         if 'y' in key and self.proj:
@@ -472,17 +479,22 @@
 
         if 'n' in key and self.proj:
             self.view.set_footer_text('', 'entry_footer')
+            self.reset_project_footer()
             return DefaultEntryListState(self.projectlist_state,
                                          self.controller, self.view)
 
         if 'esc' in key:
             self.view.set_footer_text('', 'entry_footer')
+            self.reset_project_footer()
             return DefaultEntryListState(self.projectlist_state,
                                          self.controller, self.view)
 
-        if len(key) > 0 and self.proj is None:
-            self.proj = self.controller.project_by_key(key[0])
+        if len(key) > 0 and len(key[0]) == 1 and self.proj is None:
+            self.proj_keys += key[0]
+            self.set_project_footer()
+            self.proj = self.controller.project_by_key(self.proj_keys)
             if self.proj:
+                self.reset_project_footer()
                 logger.debug("MoveEntryState: prepared entries to be moved to "\
                              "project '%s'" % self.proj.desc)
                 self.view.set_footer_text(self.msg('really'), 'question')
This site is hosted by Intevation GmbH (Datenschutzerklärung und Impressum | Privacy Policy and Imprint)