From 509aa67e93225c4718c8483b3b61a2217f9ca7e1 Mon Sep 17 00:00:00 2001 From: ladyada Date: Mon, 11 Mar 2019 22:41:22 -0400 Subject: [PATCH 1/2] update to latest text zone, Label! --- adafruit_pyportal.py | 12 ++++++++---- 1 file changed, 8 insertions(+), 4 deletions(-) diff --git a/adafruit_pyportal.py b/adafruit_pyportal.py index 993c7e5..fee59a0 100644 --- a/adafruit_pyportal.py +++ b/adafruit_pyportal.py @@ -55,7 +55,11 @@ from adafruit_esp32spi import adafruit_esp32spi import adafruit_esp32spi.adafruit_esp32spi_requests as requests -from adafruit_display_text.text_area import TextArea +try: + from adafruit_display_text.text_area import TextArea + print("*** WARNING ***\nPlease update your library bundle to the latest 'adafruit_display_text' version as we've deprecated 'text_area' in favor of 'label'") +except ImportError: + from adafruit_display_text.Label import Label from adafruit_bitmap_font import bitmap_font import storage @@ -425,7 +429,7 @@ def set_caption(self, caption_text, caption_position, caption_color): board.DISPLAY.wait_for_frame() return - self._caption = TextArea(self._caption_font, text=str(caption_text)) + self._caption = Label(self._caption_font, text=str(caption_text)) self._caption.x = caption_position[0] self._caption.y = caption_position[1] self._caption.color = caption_color @@ -452,7 +456,7 @@ def set_text(self, val, index=0): if item == self._text[index]: break items.append(item) - self._text[index] = TextArea(self._text_font, text=string) + self._text[index] = Label(self._text_font, text=string) self._text[index].color = self._text_color[index] self._text[index].x = self._text_position[index][0] self._text[index].y = self._text_position[index][1] @@ -463,7 +467,7 @@ def set_text(self, val, index=0): if self._text_position[index]: # if we want it placed somewhere... print("Making text area with string:", string) - self._text[index] = TextArea(self._text_font, text=string) + self._text[index] = Label(self._text_font, text=string) self._text[index].color = self._text_color[index] self._text[index].x = self._text_position[index][0] self._text[index].y = self._text_position[index][1] From 3680fa73e13b908bf1ea7a496a730450f7e1f4f2 Mon Sep 17 00:00:00 2001 From: ladyada Date: Mon, 11 Mar 2019 23:18:50 -0400 Subject: [PATCH 2/2] lint --- adafruit_pyportal.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/adafruit_pyportal.py b/adafruit_pyportal.py index fee59a0..8e503bf 100644 --- a/adafruit_pyportal.py +++ b/adafruit_pyportal.py @@ -56,8 +56,8 @@ from adafruit_esp32spi import adafruit_esp32spi import adafruit_esp32spi.adafruit_esp32spi_requests as requests try: - from adafruit_display_text.text_area import TextArea - print("*** WARNING ***\nPlease update your library bundle to the latest 'adafruit_display_text' version as we've deprecated 'text_area' in favor of 'label'") + from adafruit_display_text.text_area import TextArea # pylint: disable=unused-import + print("*** WARNING ***\nPlease update your library bundle to the latest 'adafruit_display_text' version as we've deprecated 'text_area' in favor of 'label'") # pylint: disable=line-too-long except ImportError: from adafruit_display_text.Label import Label from adafruit_bitmap_font import bitmap_font