Skip to content

Commit 76a9568

Browse files
authored
Merge pull request #1733 from adafruit/pyportal_openweather_cp7
pyportal openweather cp7 updates
2 parents 9285434 + 7cf08e1 commit 76a9568

File tree

1 file changed

+16
-14
lines changed

1 file changed

+16
-14
lines changed

PyPortal_OpenWeather/openweather_graphics.py

Lines changed: 16 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -12,14 +12,14 @@
1212

1313
class OpenWeather_Graphics(displayio.Group):
1414
def __init__(self, root_group, *, am_pm=True, celsius=True):
15-
super().__init__(max_size=2)
15+
super().__init__()
1616
self.am_pm = am_pm
1717
self.celsius = celsius
1818

1919
root_group.append(self)
20-
self._icon_group = displayio.Group(max_size=1)
20+
self._icon_group = displayio.Group()
2121
self.append(self._icon_group)
22-
self._text_group = displayio.Group(max_size=5)
22+
self._text_group = displayio.Group()
2323
self.append(self._text_group)
2424

2525
self._icon_sprite = None
@@ -36,25 +36,25 @@ def __init__(self, root_group, *, am_pm=True, celsius=True):
3636
self.large_font.load_glyphs(('°',)) # a non-ascii character we need for sure
3737
self.city_text = None
3838

39-
self.time_text = Label(self.medium_font, max_glyphs=9)
39+
self.time_text = Label(self.medium_font)
4040
self.time_text.x = 200
4141
self.time_text.y = 12
4242
self.time_text.color = 0xFFFFFF
4343
self._text_group.append(self.time_text)
4444

45-
self.temp_text = Label(self.large_font, max_glyphs=6)
45+
self.temp_text = Label(self.large_font)
4646
self.temp_text.x = 200
4747
self.temp_text.y = 195
4848
self.temp_text.color = 0xFFFFFF
4949
self._text_group.append(self.temp_text)
5050

51-
self.main_text = Label(self.large_font, max_glyphs=20)
51+
self.main_text = Label(self.large_font)
5252
self.main_text.x = 10
5353
self.main_text.y = 195
5454
self.main_text.color = 0xFFFFFF
5555
self._text_group.append(self.main_text)
5656

57-
self.description_text = Label(self.small_font, max_glyphs=60)
57+
self.description_text = Label(self.small_font)
5858
self.description_text.x = 10
5959
self.description_text.y = 225
6060
self.description_text.color = 0xFFFFFF
@@ -125,15 +125,17 @@ def set_icon(self, filename):
125125

126126
if not filename:
127127
return # we're done, no icon desired
128+
129+
# CircuitPython 6 & 7 compatible
128130
if self._icon_file:
129131
self._icon_file.close()
130132
self._icon_file = open(filename, "rb")
131133
icon = displayio.OnDiskBitmap(self._icon_file)
132-
try:
133-
self._icon_sprite = displayio.TileGrid(icon,
134-
pixel_shader=getattr(icon, 'pixel_shader', displayio.ColorConverter()))
135-
except TypeError:
136-
self._icon_sprite = displayio.TileGrid(icon,
137-
pixel_shader=getattr(icon, 'pixel_shader', displayio.ColorConverter()),
138-
position=(0,0))
134+
self._icon_sprite = displayio.TileGrid(
135+
icon, pixel_shader=getattr(icon, 'pixel_shader', displayio.ColorConverter()))
136+
137+
# # CircuitPython 7+ compatible
138+
# icon = displayio.OnDiskBitmap(filename)
139+
# self._icon_sprite = displayio.TileGrid(icon, pixel_shader=background.pixel_shader)
140+
139141
self._icon_group.append(self._icon_sprite)

0 commit comments

Comments
 (0)