@@ -219,29 +219,30 @@ def paint(self):
219219 board .DISPLAY .brightness = 0 # Screen backlight OFF
220220 painting = False
221221
222- gc .collect () # Helps make playback a little smoother
222+ with open (self .tempfile , 'rb' ) as file :
223+ gc .collect () # Helps make playback a little smoother
223224
224- while True :
225- action_set = {self .button_left .action (),
226- self .button_right .action ()}
227- if RichButton .TAP in action_set :
228- if painting : # If currently painting
229- self .clear_strip () # Turn LEDs OFF
230- else :
231- row = 0 # Start at beginning of file
232- painting = not painting # Toggle paint mode on/off
233- elif RichButton .HOLD in action_set :
234- return # Exit painting, enter config mode
235-
236- if painting :
237- file .seek (row * self .row_size )
238- self .spi .write (file .read (self .row_size ))
239- row += 1
240- if row >= self .num_rows :
241- if self .loop :
242- row = 0
225+ while True :
226+ action_set = {self .button_left .action (),
227+ self .button_right .action ()}
228+ if RichButton .TAP in action_set :
229+ if painting : # If currently painting
230+ self .clear_strip () # Turn LEDs OFF
243231 else :
244- painting = False
232+ row = 0 # Start at beginning of file
233+ painting = not painting # Toggle paint mode on/off
234+ elif RichButton .HOLD in action_set :
235+ return # Exit painting, enter config mode
236+
237+ if painting :
238+ file .seek (row * self .row_size )
239+ self .spi .write (file .read (self .row_size ))
240+ row += 1
241+ if row >= self .num_rows :
242+ if self .loop :
243+ row = 0
244+ else :
245+ painting = False
245246
246247
247248 # Each config screen is broken out into its own function...
0 commit comments