Changeset - 962f46713b63
[Not reviewed]
default
0 2 0
David McClosky - 18 years ago 2007-06-15 20:23:43
dmcc@bigasterisk.com
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.
2 files changed with 5 insertions and 2 deletions:
0 comments (0 inline, 0 general)
bin/keyboardcomposer
Show inline comments
 
@@ -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
light9/Submaster.py
Show inline comments
 
@@ -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
0 comments (0 inline, 0 general)