Changeset - c58e781829a3
[Not reviewed]
default
0 1 0
David McClosky - 18 years ago 2007-06-15 20:45:35
dmcc@bigasterisk.com
keyboardcomposer: sort subs by group, then order, then name
1 file changed with 4 insertions and 4 deletions:
0 comments (0 inline, 0 general)
bin/keyboardcomposer
Show inline comments
 
@@ -166,36 +166,34 @@ class KeyboardComposer(Frame, SubClient)
 
        diff = 1
 
        if event.keysym in ('Prior', 'p', 'bracketright'):
 
            diff = -1
 
        old_row = self.current_row
 
        self.current_row += diff
 
        self.current_row = max(0, self.current_row)
 
        self.current_row = min(len(self.rows) - 1, self.current_row)
 
        self.unhighlight_row(old_row)
 
        self.highlight_row(self.current_row)
 
        row = self.rows[self.current_row]
 
        self.keyhints.pack_configure(before=row)
 

	
 
        
 
        for col in range(8):
 
            try:
 
                subtk = self.slider_table[(self.current_row, col)]
 
                self.sliders.valueOut("button-upper%d" % (col + 1), 127)
 
            except KeyError:
 
                # unfilled bottom row has holes (plus rows with incomplete
 
                # groups
 
                self.sliders.valueOut("button-upper%d" % (col + 1), 0)
 
                continue
 
            self.send_to_hw(subtk.name, col + 1)
 

	
 
            
 
    def got_nudger(self, number, direction, full=0):
 
        subtk = self.slider_table[(self.current_row, number)]
 
        if direction == 'up':
 
            if full:
 
                subtk.scale.fade(1)
 
            else:
 
                subtk.scale.increase()
 
        else:
 
            if full:
 
                subtk.scale.fade(0)
 
            else:
 
@@ -207,28 +205,30 @@ class KeyboardComposer(Frame, SubClient)
 
            subtk = self.slider_table[(self.current_row, col)]
 
        except KeyError:
 
            return # no slider assigned at that column
 
        subtk.scale.set(value)
 
                
 
    def draw_sliders(self):
 
        self.tk_focusFollowsMouse()
 

	
 
        rowcount = -1
 
        col = 0
 
        last_group = None
 
        graph = showconfig.getGraph()
 
        withgroups = sorted((graph.value(sub.uri, L9['group']), sub)
 
        withgroups = sorted((graph.value(sub.uri, L9['group']), 
 
                             graph.value(sub.uri, L9['order']), 
 
                             sub)
 
            for sub in self.submasters.get_all_subs())
 

	
 
        for group, sub in withgroups:
 
        for group, order, sub in withgroups:
 
            group = graph.value(sub.uri, L9['group'])
 

	
 
            if col == 0 or group != last_group: # make new row
 
                row = self.make_row()
 
                rowcount += 1
 
                col = 0
 
            current_level = self.current_sub_levels.get(sub.name, 0)
 
            subtk = self.draw_sub_slider(row, col, sub.name, current_level)
 
            self.slider_table[(rowcount, col)] = subtk
 
            self.name_to_subtk[sub.name] = subtk
 

	
 
            def slider_changed(x, y, z, subtk=subtk,
0 comments (0 inline, 0 general)