Skip to content

Commit bccafbe

Browse files
authored
Merge pull request #1678 from FoamyGuy/weather_display_matrix_cp7
weather display matrix cp7 updates
2 parents 9fbfb6a + a46b0b3 commit bccafbe

File tree

1 file changed

+26
-16
lines changed

1 file changed

+26
-16
lines changed

Weather_Display_Matrix/openweather_graphics.py

Lines changed: 26 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -32,7 +32,7 @@ def __init__(
3232
am_pm=True,
3333
units="imperial"
3434
):
35-
super().__init__(max_size=3)
35+
super().__init__()
3636
self.am_pm = am_pm
3737
if units == "metric":
3838
self.celsius = True
@@ -42,40 +42,50 @@ def __init__(
4242
self.meters_speed = False
4343
self.display = display
4444

45-
splash = displayio.Group(max_size=1)
45+
splash = displayio.Group()
46+
# CircuitPython 6 & 7 compatible
4647
background = displayio.OnDiskBitmap(open("loading.bmp", "rb"))
4748
bg_sprite = displayio.TileGrid(
4849
background,
4950
pixel_shader=getattr(background, 'pixel_shader', displayio.ColorConverter()),
5051
)
52+
# # CircuitPython 7+ compatible
53+
# background = displayio.OnDiskBitmap("loading.bmp")
54+
# bg_sprite = displayio.TileGrid(background, pixel_shader=background.pixel_shader)
55+
5156
splash.append(bg_sprite)
5257
display.show(splash)
5358

54-
self.root_group = displayio.Group(max_size=15)
59+
self.root_group = displayio.Group()
5560
self.root_group.append(self)
56-
self._icon_group = displayio.Group(max_size=1)
61+
self._icon_group = displayio.Group()
5762
self.append(self._icon_group)
58-
self._text_group = displayio.Group(max_size=5)
63+
self._text_group = displayio.Group()
5964
self.append(self._text_group)
60-
self._scrolling_group = displayio.Group(max_size=1)
65+
self._scrolling_group = displayio.Group()
6166
self.append(self._scrolling_group)
6267

6368
# The label index we're currently scrolling
6469
self._current_label = None
6570

6671
# Load the icon sprite sheet
72+
# CircuitPython 6 & 7 compatible
6773
icons = displayio.OnDiskBitmap(open(icon_spritesheet, "rb"))
6874
self._icon_sprite = displayio.TileGrid(
6975
icons,
7076
pixel_shader=getattr(icons, 'pixel_shader', displayio.ColorConverter()),
71-
width=1,
72-
height=1,
7377
tile_width=icon_width,
74-
tile_height=icon_height,
75-
default_tile=0,
76-
x=0,
77-
y=0,
78+
tile_height=icon_height
7879
)
80+
# # CircuitPython 7+ compatible
81+
# icons = displayio.OnDiskBitmap(icon_spritesheet)
82+
# self._icon_sprite = displayio.TileGrid(
83+
# icons,
84+
# pixel_shader=icons.pixel_shader,
85+
# tile_width=icon_width,
86+
# tile_height=icon_height
87+
# )
88+
7989
self.set_icon(None)
8090
self._scrolling_texts = []
8191

@@ -88,21 +98,21 @@ def __init__(
8898

8999
self.city_text = None
90100

91-
self.temp_text = Label(self.medium_font, max_glyphs=6)
101+
self.temp_text = Label(self.medium_font)
92102
self.temp_text.x = 20
93103
self.temp_text.y = 7
94104
self.temp_text.color = TEMP_COLOR
95105
self._text_group.append(self.temp_text)
96106

97-
self.description_text = Label(self.small_font, max_glyphs=60)
107+
self.description_text = Label(self.small_font)
98108
self.description_text.color = DESCRIPTION_COLOR
99109
self._scrolling_texts.append(self.description_text)
100110

101-
self.humidity_text = Label(self.small_font, max_glyphs=14)
111+
self.humidity_text = Label(self.small_font)
102112
self.humidity_text.color = HUMIDITY_COLOR #
103113
self._scrolling_texts.append(self.humidity_text)
104114

105-
self.wind_text = Label(self.small_font, max_glyphs=10)
115+
self.wind_text = Label(self.small_font)
106116
self.wind_text.color = WIND_COLOR
107117
self._scrolling_texts.append(self.wind_text)
108118

0 commit comments

Comments
 (0)