Skip to content

Commit ebba94b

Browse files
committed
Bugfix in new animation workflow
1 parent 0e3cf9c commit ebba94b

File tree

1 file changed

+16
-11
lines changed

1 file changed

+16
-11
lines changed

push2_python/pads.py

Lines changed: 16 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -141,7 +141,12 @@ def set_pads_color(self, color_matrix, animation_matrix=None):
141141
for j, color in enumerate(line):
142142
animation = ANIMATION_DEFAULT
143143
if animation_matrix is not None:
144-
animation, animation_end_color = animation_matrix[i][j]
144+
element = animation_matrix[i][j]
145+
if type(element) == tuple:
146+
animation, animation_end_color = animation_matrix[i][j]
147+
else:
148+
animation = animation_matrix[i][j]
149+
animation_end_color = 'black'
145150
self.set_pad_color((i, j), color=color, animation=animation, animation_end_color=animation_end_color)
146151

147152
def set_all_pads_to_color(self, color='white', animation=ANIMATION_DEFAULT, animation_end_color='black'):
@@ -155,20 +160,20 @@ def set_all_pads_to_color(self, color='white', animation=ANIMATION_DEFAULT, anim
155160
animation_matrix = [[(animation, animation_end_color) for _ in range(0, 8)] for _ in range(0, 8)]
156161
self.set_pads_color(color_matrix, animation_matrix)
157162

158-
def set_all_pads_to_black(self, animation=ANIMATION_DEFAULT):
159-
self.set_all_pads_to_color('black', animation=animation, animation_end_color='black')
163+
def set_all_pads_to_black(self, animation=ANIMATION_DEFAULT, animation_end_color='black'):
164+
self.set_all_pads_to_color('black', animation=animation, animation_end_color=animation_end_color)
160165

161-
def set_all_pads_to_white(self, animation=ANIMATION_DEFAULT):
162-
self.set_all_pads_to_color('white', animation=animation, animation_end_color='black')
166+
def set_all_pads_to_white(self, animation=ANIMATION_DEFAULT, animation_end_color='black'):
167+
self.set_all_pads_to_color('white', animation=animation, animation_end_color=animation_end_color)
163168

164-
def set_all_pads_to_red(self, animation=ANIMATION_DEFAULT):
165-
self.set_all_pads_to_color('red', animation=animation, animation_end_color='black')
169+
def set_all_pads_to_red(self, animation=ANIMATION_DEFAULT, animation_end_color='black'):
170+
self.set_all_pads_to_color('red', animation=animation, animation_end_color=animation_end_color)
166171

167-
def set_all_pads_to_green(self, animation=ANIMATION_DEFAULT):
168-
self.set_all_pads_to_color('green', animation=animation, animation_end_color='black')
172+
def set_all_pads_to_green(self, animation=ANIMATION_DEFAULT, animation_end_color='black'):
173+
self.set_all_pads_to_color('green', animation=animation, animation_end_color=animation_end_color)
169174

170-
def set_all_pads_to_blue(self, animation=ANIMATION_DEFAULT):
171-
self.set_all_pads_to_color('blue', animation=animation, animation_end_color='black')
175+
def set_all_pads_to_blue(self, animation=ANIMATION_DEFAULT, animation_end_color='black'):
176+
self.set_all_pads_to_color('blue', animation=animation, animation_end_color=animation_end_color)
172177

173178
def on_midi_message(self, message):
174179
if message.type in [MIDO_NOTEON, MIDO_NOTEOFF, MIDO_POLYAT, MIDO_AFTERTOUCH]:

0 commit comments

Comments
 (0)