@@ -20,18 +20,18 @@ def __init__(self, celsius=True, usa_date=True):
20
20
:param bool usa_date: Use mon/day/year date-time formatting.
21
21
"""
22
22
# root displayio group
23
- root_group = displayio .Group (max_size = 20 )
23
+ root_group = displayio .Group ()
24
24
board .DISPLAY .show (root_group )
25
- super ().__init__ (max_size = 20 )
25
+ super ().__init__ ()
26
26
27
27
self ._celsius = celsius
28
28
self ._usa_date = usa_date
29
29
30
30
# create background icon group
31
- self ._icon_group = displayio .Group (max_size = 1 )
31
+ self ._icon_group = displayio .Group ()
32
32
board .DISPLAY .show (self ._icon_group )
33
33
# create text object group
34
- self ._text_group = displayio .Group (max_size = 6 )
34
+ self ._text_group = displayio .Group ()
35
35
36
36
self ._icon_sprite = None
37
37
self ._icon_file = None
@@ -58,22 +58,22 @@ def __init__(self, celsius=True, usa_date=True):
58
58
self .subtitle_text .y = 35
59
59
self ._text_group .append (self .subtitle_text )
60
60
61
- self .temp_text = Label (self .c_font , max_glyphs = 8 )
61
+ self .temp_text = Label (self .c_font )
62
62
self .temp_text .x = 25
63
63
self .temp_text .y = 110
64
64
self ._text_group .append (self .temp_text )
65
65
66
- self .time_text = Label (self .info_font , max_glyphs = 40 )
66
+ self .time_text = Label (self .info_font )
67
67
self .time_text .x = 240
68
68
self .time_text .y = 150
69
69
self ._text_group .append (self .time_text )
70
70
71
- self .date_text = Label (self .info_font , max_glyphs = 40 )
71
+ self .date_text = Label (self .info_font )
72
72
self .date_text .x = 30
73
73
self .date_text .y = 160
74
74
self ._text_group .append (self .date_text )
75
75
76
- self .io_status_text = Label (self .info_font , max_glyphs = 40 )
76
+ self .io_status_text = Label (self .info_font )
77
77
self .io_status_text .x = 100
78
78
self .io_status_text .y = 220
79
79
self ._text_group .append (self .io_status_text )
@@ -130,14 +130,15 @@ def set_icon(self, filename):
130
130
return # we're done, no icon desired
131
131
if self ._icon_file :
132
132
self ._icon_file .close ()
133
+
134
+ # CircuitPython 6 & 7 compatible
133
135
self ._icon_file = open (filename , "rb" )
134
136
icon = displayio .OnDiskBitmap (self ._icon_file )
135
- try :
136
- self ._icon_sprite = displayio .TileGrid (icon ,
137
- pixel_shader = getattr (icon , 'pixel_shader' , displayio .ColorConverter ()))
138
- except TypeError :
139
- self ._icon_sprite = displayio .TileGrid (icon ,
140
- pixel_shader = getattr (icon , 'pixel_shader' , displayio .ColorConverter ()),
141
- position = (0 ,0 ))
137
+ self ._icon_sprite = displayio .TileGrid (icon ,
138
+ pixel_shader = getattr (icon , 'pixel_shader' , displayio .ColorConverter ()))
139
+
140
+ # # CircuitPython 7+ compatible
141
+ # icon = displayio.OnDiskBitmap(filename)
142
+ # self._icon_sprite = displayio.TileGrid(icon, pixel_shader=icon.pixel_shader)
142
143
143
144
self ._icon_group .append (self ._icon_sprite )
0 commit comments