Skip to content

Commit 079bad8

Browse files
authored
Merge pull request #22 from lesamouraipourpre/ondiskbitmap-changes
Update the pixel_shader usage of OnDiskBitmap
2 parents 68b1cde + f81cd61 commit 079bad8

9 files changed

+75
-11
lines changed

README.rst

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -28,9 +28,6 @@ This is easily achieved by downloading
2828

2929
Installing from PyPI
3030
=====================
31-
.. note:: This library is not available on PyPI yet. Install documentation is included
32-
as a standard element. Stay tuned for PyPI availability!
33-
3431
On supported GNU/Linux systems like the Raspberry Pi, you can install the driver locally `from
3532
PyPI <https://pypi.org/project/adafruit-circuitpython-il0373/>`_. To install for current user:
3633

@@ -86,7 +83,12 @@ Usage Example
8683
f = open("/display-ruler.bmp", "rb")
8784
8885
pic = displayio.OnDiskBitmap(f)
89-
t = displayio.TileGrid(pic, pixel_shader=displayio.ColorConverter())
86+
# CircuitPython 6 & 7 compatible
87+
t = displayio.TileGrid(
88+
pic, pixel_shader=getattr(pic, "pixel_shader", displayio.ColorConverter())
89+
)
90+
# CircuitPython 7 compatible only
91+
# t = displayio.TileGrid(pic, pixel_shader=pic.pixel_shader)
9092
g.append(t)
9193
9294
display.show(g)

docs/examples.rst

Lines changed: 27 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6,3 +6,30 @@ Ensure your device works with this simple test.
66
.. literalinclude:: ../examples/il0373_simpletest.py
77
:caption: examples/il0373_simpletest.py
88
:linenos:
9+
10+
Device Specific Examples
11+
------------------------
12+
13+
.. literalinclude:: ../examples/il0373_1.54_color.py
14+
:caption: examples/il0373_1.54_color.py
15+
:linenos:
16+
17+
.. literalinclude:: ../examples/il0373_2.9_color.py
18+
:caption: examples/il0373_2.9_color.py
19+
:linenos:
20+
21+
.. literalinclude:: ../examples/il0373_2.9_grayscale.py
22+
:caption: examples/il0373_2.9_grayscale.py
23+
:linenos:
24+
25+
.. literalinclude:: ../examples/il0373_2.13_color.py
26+
:caption: examples/il0373_2.13_color.py
27+
:linenos:
28+
29+
.. literalinclude:: ../examples/il0373_flexible_2.9_monochrome.py
30+
:caption: examples/il0373_flexible_2.9_monochrome.py
31+
:linenos:
32+
33+
.. literalinclude:: ../examples/il0373_flexible_2.13_monochrome.py
34+
:caption: examples/il0373_2.13_monochrome.py
35+
:linenos:

examples/il0373_1.54_color.py

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -40,7 +40,12 @@
4040

4141
with open("/display-ruler.bmp", "rb") as f:
4242
pic = displayio.OnDiskBitmap(f)
43-
t = displayio.TileGrid(pic, pixel_shader=displayio.ColorConverter())
43+
# CircuitPython 6 & 7 compatible
44+
t = displayio.TileGrid(
45+
pic, pixel_shader=getattr(pic, "pixel_shader", displayio.ColorConverter())
46+
)
47+
# CircuitPython 7 compatible only
48+
# t = displayio.TileGrid(pic, pixel_shader=pic.pixel_shader)
4449
g.append(t)
4550

4651
display.show(g)

examples/il0373_2.13_color.py

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -47,7 +47,12 @@
4747
with open("/display-ruler.bmp", "rb") as f:
4848
pic = displayio.OnDiskBitmap(f)
4949
# Create a Tilegrid with the bitmap and put in the displayio group
50-
t = displayio.TileGrid(pic, pixel_shader=displayio.ColorConverter())
50+
# CircuitPython 6 & 7 compatible
51+
t = displayio.TileGrid(
52+
pic, pixel_shader=getattr(pic, "pixel_shader", displayio.ColorConverter())
53+
)
54+
# CircuitPython 7 compatible only
55+
# t = displayio.TileGrid(pic, pixel_shader=pic.pixel_shader)
5156
g.append(t)
5257

5358
# Place the display group on the screen

examples/il0373_2.9_color.py

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -46,7 +46,12 @@
4646
with open("/display-ruler.bmp", "rb") as f:
4747
pic = displayio.OnDiskBitmap(f)
4848
# Create a Tilegrid with the bitmap and put in the displayio group
49-
t = displayio.TileGrid(pic, pixel_shader=displayio.ColorConverter())
49+
# CircuitPython 6 & 7 compatible
50+
t = displayio.TileGrid(
51+
pic, pixel_shader=getattr(pic, "pixel_shader", displayio.ColorConverter())
52+
)
53+
# CircuitPython 7 compatible only
54+
# t = displayio.TileGrid(pic, pixel_shader=pic.pixel_shader)
5055
g.append(t)
5156

5257
# Place the display group on the screen

examples/il0373_2.9_grayscale.py

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -41,7 +41,12 @@
4141

4242
with open("/display-ruler.bmp", "rb") as f:
4343
pic = displayio.OnDiskBitmap(f)
44-
t = displayio.TileGrid(pic, pixel_shader=displayio.ColorConverter())
44+
# CircuitPython 6 & 7 compatible
45+
t = displayio.TileGrid(
46+
pic, pixel_shader=getattr(pic, "pixel_shader", displayio.ColorConverter())
47+
)
48+
# CircuitPython 7 compatible only
49+
# t = displayio.TileGrid(pic, pixel_shader=pic.pixel_shader)
4550
g.append(t)
4651

4752
display.show(g)

examples/il0373_flexible_2.13_monochrome.py

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -35,7 +35,12 @@
3535

3636
with open("/display-ruler.bmp", "rb") as f:
3737
pic = displayio.OnDiskBitmap(f)
38-
t = displayio.TileGrid(pic, pixel_shader=displayio.ColorConverter())
38+
# CircuitPython 6 & 7 compatible
39+
t = displayio.TileGrid(
40+
pic, pixel_shader=getattr(pic, "pixel_shader", displayio.ColorConverter())
41+
)
42+
# CircuitPython 7 compatible only
43+
# t = displayio.TileGrid(pic, pixel_shader=pic.pixel_shader)
3944
g.append(t)
4045

4146
display.show(g)

examples/il0373_flexible_2.9_monochrome.py

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -35,7 +35,12 @@
3535

3636
with open("/display-ruler.bmp", "rb") as f:
3737
pic = displayio.OnDiskBitmap(f)
38-
t = displayio.TileGrid(pic, pixel_shader=displayio.ColorConverter())
38+
# CircuitPython 6 & 7 compatible
39+
t = displayio.TileGrid(
40+
pic, pixel_shader=getattr(pic, "pixel_shader", displayio.ColorConverter())
41+
)
42+
# CircuitPython 7 compatible only
43+
# t = displayio.TileGrid(pic, pixel_shader=pic.pixel_shader)
3944
g.append(t)
4045

4146
display.show(g)

examples/il0373_simpletest.py

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -31,7 +31,12 @@
3131

3232
with open("/display-ruler.bmp", "rb") as f:
3333
pic = displayio.OnDiskBitmap(f)
34-
t = displayio.TileGrid(pic, pixel_shader=displayio.ColorConverter())
34+
# CircuitPython 6 & 7 compatible
35+
t = displayio.TileGrid(
36+
pic, pixel_shader=getattr(pic, "pixel_shader", displayio.ColorConverter())
37+
)
38+
# CircuitPython 7 compatible only
39+
# t = displayio.TileGrid(pic, pixel_shader=pic.pixel_shader)
3540
g.append(t)
3641

3742
display.show(g)

0 commit comments

Comments
 (0)