Skip to content

Commit 16ba302

Browse files
authored
Merge pull request #1727 from FoamyGuy/pyportal_titano_weatherstation_cp7
pyportal titano weather station cp7 updates
2 parents c7158fb + 6707207 commit 16ba302

1 file changed

Lines changed: 18 additions & 16 deletions

File tree

PyPortal_Titano_Weather_Station/openweather_graphics.py

Lines changed: 18 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -23,14 +23,14 @@
2323
class OpenWeather_Graphics(displayio.Group):
2424

2525
def __init__(self, root_group, *, am_pm=True, celsius=True):
26-
super().__init__(max_size=2)
26+
super().__init__()
2727
self.am_pm = am_pm
2828
self.celsius = celsius
2929

3030
root_group.append(self)
31-
self._icon_group = displayio.Group(max_size=1)
31+
self._icon_group = displayio.Group()
3232
self.append(self._icon_group)
33-
self._text_group = displayio.Group(max_size=12)
33+
self._text_group = displayio.Group()
3434
self.append(self._text_group)
3535

3636
self._icon_sprite = None
@@ -50,31 +50,31 @@ def __init__(self, root_group, *, am_pm=True, celsius=True):
5050
self.city_text = None
5151
self.holiday_text = None
5252

53-
self.time_text = Label(self.medium_font, max_glyphs=8)
53+
self.time_text = Label(self.medium_font)
5454
self.time_text.x = 365
5555
self.time_text.y = 15
5656
self.time_text.color = 0x5AF78E
5757
self._text_group.append(self.time_text)
5858

59-
self.date_text = Label(self.medium_font, max_glyphs=60)
59+
self.date_text = Label(self.medium_font)
6060
self.date_text.x = 10
6161
self.date_text.y = 15
6262
self.date_text.color = 0x57C6FE
6363
self._text_group.append(self.date_text)
6464

65-
self.temp_text = Label(self.large_font, max_glyphs=6)
65+
self.temp_text = Label(self.large_font)
6666
self.temp_text.x = 316
6767
self.temp_text.y = 165
6868
self.temp_text.color = 0xFF6AC1
6969
self._text_group.append(self.temp_text)
7070

71-
self.main_text = Label(self.weather_font, max_glyphs=20)
71+
self.main_text = Label(self.weather_font)
7272
self.main_text.x = 10
7373
self.main_text.y = 258
7474
self.main_text.color = 0x99ECFD
7575
self._text_group.append(self.main_text)
7676

77-
self.description_text = Label(self.small_font, max_glyphs=60)
77+
self.description_text = Label(self.small_font)
7878
self.description_text.x = 10
7979
self.description_text.y = 296
8080
self.description_text.color = 0x9FA0A2
@@ -151,7 +151,7 @@ def update_date(self):
151151
h = holiday_checks.index(i)
152152
if holiday_date_str == holiday_checks[h]:
153153
if not self.holiday_text:
154-
self.holiday_text = Label(self.medium_font, max_glyphs=60)
154+
self.holiday_text = Label(self.medium_font)
155155
self.holiday_text.x = 10
156156
self.holiday_text.y = 45
157157
self.holiday_text.color = 0xf2f89d
@@ -172,13 +172,15 @@ def set_icon(self, filename):
172172
return # we're done, no icon desired
173173
if self._icon_file:
174174
self._icon_file.close()
175+
176+
# CircuitPython 6 & 7 compatible
175177
self._icon_file = open(filename, "rb")
176178
icon = displayio.OnDiskBitmap(self._icon_file)
177-
try:
178-
self._icon_sprite = displayio.TileGrid(icon,
179-
pixel_shader=getattr(icon, 'pixel_shader', displayio.ColorConverter()))
180-
except TypeError:
181-
self._icon_sprite = displayio.TileGrid(icon,
182-
pixel_shader=getattr(icon, 'pixel_shader', displayio.ColorConverter()),
183-
position=(0,0))
179+
self._icon_sprite = displayio.TileGrid(icon,
180+
pixel_shader=getattr(icon, 'pixel_shader', displayio.ColorConverter()))
181+
182+
# # CircuitPython 7+ compatible
183+
# icon = displayio.OnDiskBitmap(filename)
184+
# self._icon_sprite = displayio.TileGrid(icon, pixel_shader=icon.pixel_shader)
185+
184186
self._icon_group.append(self._icon_sprite)

0 commit comments

Comments
 (0)