Mercurial > getan > getan
comparison getan/view.py @ 219:71638dcc5a0f
Remove self.focused usage
self.focus did track the current list item number of the focused node. Instead
use urwids methods to get and set the item in the focus.
author | Björn Ricks <bjoern.ricks@intevation.de> |
---|---|
date | Fri, 05 Apr 2013 20:03:37 +0200 |
parents | 29e1a68589a0 |
children | 54e8b355164c |
comparison
equal
deleted
inserted
replaced
218:29e1a68589a0 | 219:71638dcc5a0f |
---|---|
83 return None | 83 return None |
84 | 84 |
85 def select(self): | 85 def select(self): |
86 if not self.rows: | 86 if not self.rows: |
87 return None | 87 return None |
88 node = self.rows[self.focused] | 88 node = self.node_in_focus() |
89 logger.debug("ListWidget: select row '%s'" % self.focused) | 89 logger.info("ListWidget: select row '%s'" % node) |
90 node.select() | 90 node.select() |
91 if node.selected: | 91 if node.selected: |
92 self.selection.append(node) | 92 self.selection.append(node) |
93 else: | 93 else: |
94 if node in self.selection: | 94 if node in self.selection: |
99 def clear(self): | 99 def clear(self): |
100 logger.debug("EntryList: clear focus and selection of all entries.") | 100 logger.debug("EntryList: clear focus and selection of all entries.") |
101 for node in self.selection: | 101 for node in self.selection: |
102 if node.selected: | 102 if node.selected: |
103 node.select() | 103 node.select() |
104 self.update_focus(-1, self.focused) | 104 self.set_focus(0) |
105 self.focused = False | |
106 | 105 |
107 | 106 |
108 class ProjectNode(urwid.WidgetWrap): | 107 class ProjectNode(urwid.WidgetWrap): |
109 MODES = [ | 108 MODES = [ |
110 (0, _('Total')), | 109 (0, _('Total')), |