Handle sort attribute on Selection field

This commit is contained in:
Cédric Krier committed 2008-09-30 19:49:16 +02:00
1 parent f100fda9a1
commit a03d6dd19b
2 files changed
+4 -2

No files matched your search

@@ -46,7 +46,8 @@ class Selection(WidgetInterface):
except Exception, exception:
common.process_exception(exception, self._window)
selection = []
selection.sort(lambda x, y: cmp(x[1], y[1]))
if attrs.get('sort', True):
selection.sort(lambda x, y: cmp(x[1], y[1]))
attrs['selection'] = selection
self.set_popdown(selection)
self.last_key = (None, 0)
@@ -628,7 +628,8 @@ class Selection(Char):
except Exception, exception:
common.process_exception(exception, self.window)
selection = []
selection.sort(lambda x, y: cmp(x[1], y[1]))
if self.attrs.get('sort', True):
selection.sort(lambda x, y: cmp(x[1], y[1]))
self.attrs['selection'] = selection
self.selection = selection
for i in self.selection: