Mercurial > getan
changeset 277:3d6315be2251
Use new set_focus method in all States
author | Björn Ricks <bjoern.ricks@intevation.de> |
---|---|
date | Fri, 12 Apr 2013 09:38:34 +0200 |
parents | dd575513ee1b |
children | 96037ad10cff |
files | getan/states.py |
diffstat | 1 files changed, 23 insertions(+), 9 deletions(-) [+] |
line wrap: on
line diff
--- a/getan/states.py Fri Apr 12 09:37:40 2013 +0200 +++ b/getan/states.py Fri Apr 12 09:38:34 2013 +0200 @@ -88,10 +88,11 @@ new_state = DefaultEntryListState(self, self.controller, self.controller.entries_view) self.set_next_state(new_state) - self.controller.view.set_focus(1) - self.controller.entries_view.set_focus(0) return True + def set_focus(self): + self.controller.view.set_focus("projects") + class PausedProjectsState(ProjectState): @@ -286,14 +287,12 @@ if keys.get_add_time() in key: self.view.set_footer_text(self.msg('add_time'), 'question', 1) - self.view.frame.set_focus('footer') self.set_next_state(AddTimeState(self.controller, self.view, self)) return True if keys.get_subtract_time() in key: self.view.set_footer_text(self.msg('min_time'), 'question', 1) - self.view.frame.set_focus('footer') self.set_next_state(SubtractTimeState(self.controller, self.view, self)) return True @@ -319,8 +318,8 @@ proj = self.project if proj: proj.start += datetime.now() - self.break_start - self.controller.view.set_footer_text(self.msg('description'),'question',1) - self.controller.view.get_frame().set_focus('footer') + self.controller.view.set_footer_text(self.msg('description'), + 'question', edit=True) self.set_next_state(DescriptionProjectsState(self.controller, self.view, self, self.controller.view.get_frame().get_footer())) return True @@ -370,6 +369,10 @@ "adding/subtracting time: '%r'" % key) return True + def set_focus(self): + self.controller.view.set_focus("projects") + self.view.frame.set_focus("footer") + class AddTimeState(BaseTimeState): @@ -418,7 +421,6 @@ return True self.controller.stop_project(text) self.controller.view.set_footer_text(self.msg('choose_proj'), 'question') - self.controller.view.set_focus("body") self.set_next_state(PausedProjectsState(self.controller, self.view)) return True @@ -431,6 +433,9 @@ signal.alarm(1) return super(DescriptionProjectsState, self).exit() + def set_focus(self): + self.controller.view.set_focus("footer") + class EntryListState(State): @@ -463,6 +468,10 @@ f = e_len - 1 self.view.set_focus(f) + def set_focus(self): + self.controller.view.set_focus("entries") + self.controller.entries_view.set_focus(0) + class DefaultEntryListState(EntryListState): @@ -629,7 +638,6 @@ def __init__(self, controller, view): super(AlterProjectState, self).__init__(controller, view, None, controller.view.get_frame().get_footer()) - self.controller.view.set_focus('footer') def exit(self): self.controller.view.set_footer_text(self.msg('choose_proj'), @@ -641,6 +649,9 @@ """ Direct key to frame of GetanView """ self.controller.view.frame.keypress(size, key) + def set_focus(self): + self.controller.view.set_focus("footer") + class AddProjectKeyState(AlterProjectState): @@ -697,7 +708,6 @@ None, view.footer) self.footer.set_edit_text(entry.desc) self.footer.set_edit_pos(len(self.footer.edit_text)) - self.view.frame.set_focus('footer') self.entry = entry self.state = state logger.debug("EditEntryState: Entry %s" % entry) @@ -718,6 +728,10 @@ self.view)) return True + def set_focus(self): + self.controller.view.set_focus("entries") + self.view.frame.set_focus("footer") + class ProjectEditKeyState(AlterProjectState):