Mercurial > getan
changeset 528:210bd796829e
Updates the description of an entry
* When describing an entry, you can now use the arrow keys to select and edit
old descriptions.
* bumps to 3.2.dev1
author | Magnus Schieder <mschieder@intevation.de> |
---|---|
date | Mon, 03 Jun 2019 20:19:17 +0200 |
parents | fab6ff9b248e |
children | 9d27713164c9 |
files | getan/__init__.py getan/states.py |
diffstat | 2 files changed, 26 insertions(+), 1 deletions(-) [+] |
line wrap: on
line diff
--- a/getan/__init__.py Thu Jan 24 12:47:33 2019 +0100 +++ b/getan/__init__.py Mon Jun 03 20:19:17 2019 +0200 @@ -6,5 +6,5 @@ # This is Free Software licensed under the terms of GPLv3 or later. # For details see LICENSE coming with the source of 'getan'. -__version_info__ = ("3", "2") +__version_info__ = ("3", "2", "dev1") __version__ = '.'.join(__version_info__)
--- a/getan/states.py Thu Jan 24 12:47:33 2019 +0100 +++ b/getan/states.py Mon Jun 03 20:19:17 2019 +0200 @@ -453,11 +453,36 @@ super(DescriptionProjectsState, self).__init__(controller, view, state, footer) self.project = project + self.history_position = - 1 def keypress(self, size, key): """ Direct key to frame of GetanView """ + self.controller.view.frame.keypress(size, key) + entries = self.project.backend.load_entries(self.project.id) + if key == 'up': + if self.history_position < len(entries) - 1: + self.history_position = self.history_position + 1 + self.controller.view.frame.footer.set_edit_text( + entries[self.history_position].desc) + self.controller.view.frame.footer.set_edit_pos( + len(entries[self.history_position].desc)) + + if key == 'down': + if self.history_position >= 0: + self.history_position = self.history_position - 1 + if self.history_position == -1: + self.controller.view.frame.footer.set_edit_text("") + self.controller.view.frame.footer.set_edit_pos(0) + else: + self.controller.view.frame.footer.set_edit_text( + entries[self.history_position].desc) + self.controller.view.frame.footer.set_edit_pos( + len(entries[self.history_position].desc)) + + + def enter(self): text = self.footer.get_edit_text() self.controller.stop_project(text)