Mercurial > getan > getan
diff getan/states.py @ 439:3103429ec963
Makes 'move' operation more consistent.
* Improves 'move' operation to work in the current entry, if there is no
selection. This is more consistent with 'delete'. Patch by Frank Koormann.
* Removes two superfluous methods in controller.
* Improves README: Adds Frank Koormann as contributor. Better phrasing
for the license indication.
* TODO: Details problem with multi-selections.
author | Bernhard Reiter <bernhard@intevation.de> |
---|---|
date | Wed, 13 Sep 2017 09:06:28 +0200 |
parents | 0650c47e7a1c |
children | ea2691143d74 |
line wrap: on
line diff
--- a/getan/states.py Tue Sep 12 14:52:30 2017 +0200 +++ b/getan/states.py Wed Sep 13 09:06:28 2017 +0200 @@ -533,6 +533,11 @@ if self.view.selection: self.set_next_state(MoveEntryState(self.projectlist_state, self.controller, self.view)) + else: + entry = self.view.item_in_focus() + self.set_next_state(MoveEntryState(self.projectlist_state, + self.controller, + self.view, [entry])) return True if keys.get_entry_edit() in key: @@ -608,11 +613,14 @@ proj = None - def __init__(self, state, controller, view): + def __init__(self, state, controller, view, entries=None): super(MoveEntryState, self).__init__(state, controller, view) self.view.set_footer_text(self.msg('project'), 'question') + self.entries = entries self.proj_keys = "" self.project_view = controller.project_view + if not self.entries: + self.entries = [x.item for x in self.view.selection] def set_project_footer(self): self.project_view.set_footer_text("Selecting project from " @@ -638,7 +646,7 @@ keys = self.config.get_keybinding() if 'y' in key and self.proj: logger.debug("MoveEntryState: move selected entries.") - self.controller.move_selected_entries(self.proj) + self.controller.move_entries(self.entries, self.proj) self.renew_focus() self.view.set_footer_text('', 'entry_footer') self.proj = None @@ -685,6 +693,9 @@ return False + def set_focus(self): + self.controller.view.set_focus("entries") + class AlterProjectState(HandleUserInputState):