Mercurial > code > home > repos > light9
changeset 375:962f46713b63
keyboardcomposer: sort subs by groups first, fix sub cmp
The "None" group goes first, then all groups sorted by names. Within groups,
subs are sorted by names. Subs sort by their __repr__, which could be a
problem in the future.
author | David McClosky <dmcc@bigasterisk.com> |
---|---|
date | Fri, 15 Jun 2007 20:23:43 +0000 |
parents | 5cda9c5f66dd |
children | b74c50018564 |
files | bin/keyboardcomposer light9/Submaster.py |
diffstat | 2 files changed, 5 insertions(+), 2 deletions(-) [+] |
line wrap: on
line diff
--- a/bin/keyboardcomposer Fri Jun 15 20:18:49 2007 +0000 +++ b/bin/keyboardcomposer Fri Jun 15 20:23:43 2007 +0000 @@ -212,7 +212,10 @@ col = 0 last_group = None graph = showconfig.getGraph() - for sub in self.submasters.get_all_subs(): + withgroups = sorted((graph.value(sub.uri, L9['group']), sub) + for sub in self.submasters.get_all_subs()) + + for group, sub in withgroups: group = graph.value(sub.uri, L9['group']) if col == 0 or group != last_group: # make new row
--- a/light9/Submaster.py Fri Jun 15 20:18:49 2007 +0000 +++ b/light9/Submaster.py Fri Jun 15 20:23:43 2007 +0000 @@ -173,7 +173,7 @@ return xfaded_sub def __cmp__(self, other): - raise NotImplementedError + """Compare by sub repr (name, hopefully)""" return cmp(repr(self), repr(other)) def __hash__(self): raise NotImplementedError