Mercurial > getan
changeset 48:d2cc754b4dcd project-tree
Bugfix: Projects with children are no longer selectable - projects with keys that are longer than a single character are selectable via text input again.
author | Ingo Weinzierl <ingo_weinzierl@web.de> |
---|---|
date | Mon, 28 Feb 2011 19:32:40 +0100 |
parents | 0a0c77b8606a |
children | a3c0a4fc55fb |
files | ChangeLog getan/states.py |
diffstat | 2 files changed, 28 insertions(+), 4 deletions(-) [+] |
line wrap: on
line diff
--- a/ChangeLog Tue Feb 15 21:10:19 2011 +0100 +++ b/ChangeLog Mon Feb 28 19:32:40 2011 +0100 @@ -1,3 +1,9 @@ +2011-02-28 Ingo Weinzierl <ingo@intevation.de> + + * getan/states.py: Bugfix: Projects with children are no longer selectable + and project which key is longer than a single character are selectable via + text input. + 2011-02-15 Ingo Weinzierl <ingo@intevation.de> * getan/states.py: Bugfix: We are able to move entries into projects with
--- a/getan/states.py Tue Feb 15 21:10:19 2011 +0100 +++ b/getan/states.py Mon Feb 28 19:32:40 2011 +0100 @@ -47,8 +47,11 @@ class PausedProjectsState(ProjectState): messages = { 'choose_proj': _('Choose a project: '), + 'choose': _('Choose a project: %s'), } + theKey = "" + def keypress(self, key): logger.debug("PausedProjectsState: handle key '%r'" % key) ret = super(PausedProjectsState, self).keypress(key) @@ -67,15 +70,25 @@ if 'esc' in key: return ExitState(self.controller, self.view) + if 'backspace' in key: + if len(self.theKey) > 0: + self.theKey = self.theKey[0:len(self.theKey)-1] + self.controller.view.set_footer_text( + self.msg('choose') % self.theKey, 'question') + else: if len(key) > 0: - proj = self.controller.project_by_key(key[0]) - if proj: + self.theKey += key[0] + proj = self.controller.project_by_key(self.theKey) + if proj and not proj.children: self.view.select_project(proj) self.controller.start_project(self.view.item_in_focus()) self.controller.update_entries( self.view.item_in_focus()) return RunningProjectsState(self.controller, self.view) + else: + self.controller.view.set_footer_text( + self.msg('choose') % self.theKey, 'question') return self def up(self): @@ -89,8 +102,13 @@ return self def select(self): - self.controller.start_project(self.view.item_in_focus()) - return RunningProjectsState(self.controller, self.view) + if self.theKey: return self + + cur = self.view.item_in_focus() + if not cur.children: + self.controller.start_project(cur) + return RunningProjectsState(self.controller, self.view) + return self class ExitState(ProjectState):