# HG changeset patch # User Björn Ricks # Date 1381482230 -7200 # Node ID afe36c18417fb1f495499a306b4b0bbd7bea07a2 # Parent fcbdecb0f9e006c9e0fca2b281de64b7d71ae015 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. diff -r fcbdecb0f9e0 -r afe36c18417f getan/view.py --- 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):