# HG changeset patch # User Ingo Weinzierl # Date 1298917960 -3600 # Node ID d2cc754b4dcda064a590f0e136900a616f49ec95 # Parent 0a0c77b8606a6ef6b0d54593cfa3f092113e790c Bugfix: Projects with children are no longer selectable - projects with keys that are longer than a single character are selectable via text input again. diff -r 0a0c77b8606a -r d2cc754b4dcd ChangeLog --- 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 + + * 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 * getan/states.py: Bugfix: We are able to move entries into projects with diff -r 0a0c77b8606a -r d2cc754b4dcd getan/states.py --- 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):