Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Call to Tilegrid fails after latest displayio update #14

Closed
jerryneedell opened this issue Mar 14, 2019 · 5 comments · Fixed by #15
Closed

Call to Tilegrid fails after latest displayio update #14

jerryneedell opened this issue Mar 14, 2019 · 5 comments · Fixed by #15

Comments

@jerryneedell
Copy link
Contributor

see adafruit/circuitpython#1646

@ladyada
Copy link
Member

ladyada commented Mar 14, 2019

yay - want to try a PR that try/excepts so either works?

@jerryneedell
Copy link
Contributor Author

Sure, but I can’t work on it until late today or tomorrow. Happy to do it then but if someone else wants to fix it first, go ahead.

@jerryneedell
Copy link
Contributor Author

jerryneedell commented Mar 14, 2019

:-( display_text is also broken by this...
https://github.com/adafruit/Adafruit_CircuitPython_Display_Text/blob/master/adafruit_display_text/label.py#L107

I guess I should do the same fix to it -- Her is what I was plannig -- let me know if is waht you want before I go too far down this rabbit hole.

diff --git a/adafruit_pyportal.py b/adafruit_pyportal.py
index 8e503bf..4bc9650 100644
--- a/adafruit_pyportal.py
+++ b/adafruit_pyportal.py
@@ -359,17 +359,27 @@ class PyPortal:
         if isinstance(file_or_color, str): # its a filenme:
             self._bg_file = open(file_or_color, "rb")
             background = displayio.OnDiskBitmap(self._bg_file)
-            self._bg_sprite = displayio.TileGrid(background,
-                                                 pixel_shader=displayio.ColorConverter(),
-                                                 position=position)
+            try:
+                self._bg_sprite = displayio.TileGrid(background,
+                                                     pixel_shader=displayio.ColorConverter(),
+                                                     position=position)
+            except TypeError:
+                self._bg_sprite = displayio.TileGrid(background,
+                                                     pixel_shader=displayio.ColorConverter(),
+                                                     x=position[0], y=position[1])
         elif isinstance(file_or_color, int):
             # Make a background color fill
             color_bitmap = displayio.Bitmap(320, 240, 1)
             color_palette = displayio.Palette(1)
             color_palette[0] = file_or_color
-            self._bg_sprite = displayio.TileGrid(color_bitmap,
-                                                 pixel_shader=color_palette,
-                                                 position=(0, 0))
+            try:
+                self._bg_sprite = displayio.TileGrid(color_bitmap,
+                                                     pixel_shader=color_palette,
+                                                     position=(0, 0))
+            except TypeError:
+                self._bg_sprite = displayio.TileGrid(color_bitmap,
+                                                     pixel_shader=color_palette,
+                                                     x=position[0], y=position[1])
         else:
             raise RuntimeError("Unknown type of background")
         self._bg_group.append(self._bg_sprite)
~

with this fix -- it still works on older release but now fails with

Adafruit CircuitPython 4.0.0-beta.3-34-g494a9d382 on 2019-03-13; Adafruit PyPortal with samd51j20
>>> import eventcountdown
ESP firmware: bytearray(b'1.2.2\x00')
Set background to  /countdown_background.bmp
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
  File "eventcountdown.py", line 42, in <module>
  File "adafruit_display_text/label.py", line 77, in __init__
  File "adafruit_display_text/label.py", line 107, in _update_text
TypeError: extra keyword arguments given
>>> 

on master since lable.py uses "position"

@ladyada
Copy link
Member

ladyada commented Mar 14, 2019

yep we have to go through and fix label to - just the same way. wanna do that and tag me on the PR? ill review!

@jerryneedell
Copy link
Contributor Author

sure

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants