[Getan-commits] [PATCH] Switch to projects when entries are empty
Wald Commits
scm-commit at wald.intevation.org
Wed May 9 15:18:37 CEST 2018
# HG changeset patch
# User Magnus Schieder <mschieder at intevation.de>
# Date 1525871616 -7200
# Node ID b9e30e55684481d0c9f5d16c959856092f04119f
# Parent ca6d11781e2fdf7eba66deb0f0a3ccac348a3e8d
Switch to projects when entries are empty.
*update CHANGES
diff -r ca6d11781e2f -r b9e30e556844 CHANGES
--- a/CHANGES Wed May 09 13:38:04 2018 +0200
+++ b/CHANGES Wed May 09 15:13:36 2018 +0200
@@ -1,8 +1,13 @@
2.x 20xx-xx-xx UNRELEASED
+ * Better fix for the multiple selection bug.
+ The multi-selection is deleted when deleting or moving is confirmed.
+
* Better control of the walker.
If you move entries and switch back to the projects you get to the project
you were in. Before, you always got the first project.
+ If the entries are empty, the walker will automatically switches to the
+ projects.
Patch by Magnus Schieder
* Enhanced overview.
diff -r ca6d11781e2f -r b9e30e556844 getan/states.py
--- a/getan/states.py Wed May 09 13:38:04 2018 +0200
+++ b/getan/states.py Wed May 09 15:13:36 2018 +0200
@@ -493,11 +493,12 @@
def renew_focus(self):
e_len = self.view.row_count()
if e_len == 0:
- return
+ return False
f = self.view.get_focus_pos()
if f >= e_len:
f = e_len - 1
self.view.set_focus(f)
+ return True
def set_focus(self):
self.controller.view.set_focus("entries")
@@ -589,13 +590,18 @@
if 'y' in key:
if self.entries:
self.controller.delete_entries(self.entries)
- self.renew_focus()
+ new_focus = self.renew_focus()
self.projectlist_state.view.update_rows()
# Deletes the selection of entries
self.view.selection = []
self.view.set_footer_text("", 'entry_footer')
# avoid creating new DefaultEntryListState and setting focus
- self.set_next_state(self.old_state)
+ if new_focus:
+ self.set_next_state(self.old_state)
+ else:
+ self.set_next_state(self.projectlist_state)
+ self.controller.view.set_focus(0)
+
self.controller.project_view.show_total_time()
return True
@@ -653,14 +659,19 @@
if 'y' in key and self.proj:
logger.debug("MoveEntryState: move selected entries.")
self.controller.move_entries(self.entries, self.proj)
- self.renew_focus()
+ new_focus = self.renew_focus()
# Deletes the selection of entries
self.view.selection = []
self.view.set_footer_text('', 'entry_footer')
self.proj = None
- self.set_next_state(DefaultEntryListState(self.projectlist_state,
- self.controller,
- self.view))
+ if new_focus:
+ self.set_next_state(DefaultEntryListState(self.projectlist_state,
+ self.controller,
+ self.view))
+ else:
+ self.set_next_state(self.projectlist_state)
+ self.controller.view.set_focus(0)
+
return True
if 'n' in key and self.proj:
More information about the Getan-commits
mailing list