Mercurial > getan
changeset 306:afe36c18417f
Allow to deactivate the selection of projects
By default all keys are first handled by the urwid element itself and afterwards
by the current state. Therefore pressing enter in the ProjectView will always
result in selecting the current entry node. This isn't always the desired result
and therefore allow to deactivate the selection.
author | Björn Ricks <bjoern.ricks@intevation.de> |
---|---|
date | Fri, 11 Oct 2013 11:03:50 +0200 |
parents | fcbdecb0f9e0 |
children | b97d18d58f85 |
files | getan/view.py |
diffstat | 1 files changed, 16 insertions(+), 0 deletions(-) [+] |
line wrap: on
line diff
--- a/getan/view.py Fri Oct 11 11:01:12 2013 +0200 +++ b/getan/view.py Fri Oct 11 11:03:50 2013 +0200 @@ -156,6 +156,7 @@ self.top = 0 self.controller = controller self.project_mode = 0 + self.selection_deactivated = False self.set_raw_rows(rows) super(ProjectList, self).__init__("Projects", rows) self.create_node_rows() @@ -263,6 +264,21 @@ if item: self.controller.update_entries(item) + def keypress(self, size, key): + if key == "enter" and self.is_selection_deactivated(): + return + else: + return super(ProjectList, self).keypress(size, key) + + def is_selection_deactivated(self): + return self.selection_deactivated + + def deactivate_selection(self): + self.selection_deactivated = True + + def enable_selection(self): + self.selection_deactivated = False + class EntryList(ListWidget):