@@ -258,20 +258,21 @@ def tick(self, now):
258258 except IndexError :
259259 pass
260260 filename = "/icons/" + weather_icon_name + ".bmp"
261+
261262 if filename :
263+ # CircuitPython 6 & 7 compatible
262264 if self .icon_file :
263265 self .icon_file .close ()
264266 self .icon_file = open (filename , "rb" )
265267 icon = displayio .OnDiskBitmap (self .icon_file )
266- try :
267- icon_sprite = displayio .TileGrid (icon ,
268- pixel_shader = getattr (icon , 'pixel_shader' , displayio .ColorConverter ()),
269- x = 0 , y = 0 )
270- except TypeError :
271- icon_sprite = displayio .TileGrid (icon ,
272- pixel_shader = getattr (icon , 'pixel_shader' , displayio .ColorConverter ()),
273- position = (0 , 0 ))
274268
269+ icon_sprite = displayio .TileGrid (icon ,
270+ pixel_shader = getattr (icon , 'pixel_shader' , displayio .ColorConverter ()),
271+ x = 0 , y = 0 )
272+
273+ # # CircuitPython 7+ compatible
274+ # icon = displayio.OnDiskBitmap(filename)
275+ # icon_sprite = displayio.TileGrid(icon, pixel_shader=icon.pixel_shader)
275276
276277 self .weather_icon .append (icon_sprite )
277278
@@ -333,18 +334,18 @@ def enter(self):
333334 pyportal .splash .append (ta )
334335 pyportal .splash .append (self .weather_icon )
335336 if snooze_time :
337+ # CircuitPython 6 & 7 compatible
336338 if self .snooze_file :
337339 self .snooze_file .close ()
338340 self .snooze_file = open ('/icons/zzz.bmp' , "rb" )
339341 icon = displayio .OnDiskBitmap (self .snooze_file )
340- try :
341- icon_sprite = displayio .TileGrid (icon ,
342- pixel_shader = getattr (icon , 'pixel_shader' , displayio .ColorConverter ()),
343- x = 0 , y = 0 )
344- except TypeError :
345- icon_sprite = displayio .TileGrid (icon ,
346- pixel_shader = getattr (icon , 'pixel_shader' , displayio .ColorConverter ()),
347- position = (0 , 0 ))
342+ icon_sprite = displayio .TileGrid (icon ,
343+ pixel_shader = getattr (icon , 'pixel_shader' , displayio .ColorConverter ()))
344+
345+ # # CircuitPython 7+ compatible
346+ # icon = displayio.OnDiskBitmap("/icons/zzz.bmp")
347+ # icon_sprite = displayio.TileGrid(icon, pixel_shader=icon.pixel_shader)
348+
348349 self .snooze_icon .append (icon_sprite )
349350 pyportal .splash .append (self .snooze_icon )
350351 if alarm_enabled :
0 commit comments