# HG changeset patch # User Ingo Weinzierl # Date 1297800619 -3600 # Node ID 0a0c77b8606a6ef6b0d54593cfa3f092113e790c # Parent 780bfda9c583948838cd52db8e5596f275e7b65c #1921 Bugfix: Moving entries into projects with keys that consist of more than a single char works again. diff -r 780bfda9c583 -r 0a0c77b8606a ChangeLog --- a/ChangeLog Tue Dec 21 19:34:03 2010 +0100 +++ b/ChangeLog Tue Feb 15 21:10:19 2011 +0100 @@ -1,3 +1,8 @@ +2011-02-15 Ingo Weinzierl + + * getan/states.py: Bugfix: We are able to move entries into projects with + a key that consist of more than one single char again. + 2010-12-21 Ingo Weinzierl * getan.py: Added a method to sort the projects based on its key. diff -r 780bfda9c583 -r 0a0c77b8606a getan/states.py --- a/getan/states.py Tue Dec 21 19:34:03 2010 +0100 +++ b/getan/states.py Tue Feb 15 21:10:19 2011 +0100 @@ -401,11 +401,13 @@ class MoveEntryState(EntryListState): messages = { - 'project': _(" Into which project do you want to move these entries?"), + 'project': _(" Into which project do you want to move these entries?" \ + " (> %s)"), 'really': _(" Are you sure? (> %s) (y/n)"), } - proj = None + proj = None + theKey = "" def __init__(self, state, controller, view): super(MoveEntryState, self).__init__(state, controller, view) @@ -431,11 +433,24 @@ return DefaultEntryListState(self.projectlist_state, self.controller, self.view) + if 'backspace' in key: + if len(self.theKey) > 0: + self.theKey = self.theKey[0:len(self.theKey)-1] + self.view.set_footer_text(self.msg('project') % self.theKey, + 'question') + return self + if len(key) > 0 and self.proj is None: - self.proj = self.controller.project_by_key(key[0]) - if self.proj: + self.theKey += key[0] + proj = self.controller.project_by_key(self.theKey) + if not proj or proj.children: + self.view.set_footer_text(self.msg('project') % self.theKey, + 'question') + return self + if proj and not proj.children: + self.proj = proj logger.debug("MoveEntryState: prepared entries to be moved to "\ "project '%s'" % self.proj.desc) - self.view.set_footer_text(self.msg('really'), 'question') + self.view.set_footer_text(self.msg('really') % self.proj.desc, 'question') return self