# HG changeset patch # User David McClosky # Date 1181939023 0 # Node ID 962f46713b63c6f5bbaea99df8cc1e4b28a770fe # Parent 5cda9c5f66dd3b52d6b992c39ffa50f087d38993 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. diff -r 5cda9c5f66dd -r 962f46713b63 bin/keyboardcomposer --- 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 diff -r 5cda9c5f66dd -r 962f46713b63 light9/Submaster.py --- 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