# HG changeset patch # User David McClosky # Date 2007-06-15 20:23:43 # 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 --git a/bin/keyboardcomposer b/bin/keyboardcomposer --- a/bin/keyboardcomposer +++ b/bin/keyboardcomposer @@ -212,7 +212,10 @@ class KeyboardComposer(Frame, SubClient) 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 --git a/light9/Submaster.py b/light9/Submaster.py --- a/light9/Submaster.py +++ b/light9/Submaster.py @@ -173,7 +173,7 @@ class Submaster: 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