diff --git a/README.rst b/README.rst index 69095e0..ef2ec2a 100644 --- a/README.rst +++ b/README.rst @@ -17,7 +17,8 @@ Introduction :target: https://github.com/psf/black :alt: Code Style: Black -Helper library for the Adafruit RGB Matrix Shield + Metro M4 Airlift Lite. +CircuitPython helper for Adafruit MatrixPortal M4, Adafruit RGB Matrix Shield + Metro M4 Airlift Lite, +and Adafruit RGB Matrix FeatherWings Dependencies diff --git a/adafruit_matrixportal/matrixportal.py b/adafruit_matrixportal/matrixportal.py index 9fb4346..f037067 100755 --- a/adafruit_matrixportal/matrixportal.py +++ b/adafruit_matrixportal/matrixportal.py @@ -124,6 +124,7 @@ def __init__( self._text_maxlen = [] self._text_transform = [] self._text_scrolling = [] + self._text_scale = [] self._scrolling_index = None self._text_font = terminalio.FONT self._text_line_spacing = [] @@ -139,6 +140,7 @@ def add_text( text_wrap=False, text_maxlen=0, text_transform=None, + text_scale=1, scrolling=False, line_spacing=1.25, ): @@ -155,6 +157,7 @@ def add_text( ``False``, no wrapping. :param text_maxlen: The max length of the text for text wrapping. Defaults to 0. :param text_transform: A function that will be called on the text before display + :param int text_scale: The factor to scale the default size of the text by :param bool scrolling: If true, text is placed offscreen and the scroll() function is used to scroll text on a pixel-by-pixel basis. Multiple text labels with the scrolling set to True will be cycled through. @@ -171,6 +174,9 @@ def add_text( text_maxlen = 0 if not text_transform: text_transform = None + if not isinstance(text_scale, (int, float)) or text_scale < 1: + text_scale = 1 + text_scale = round(text_scale) if scrolling: text_position = (self.display.width, text_position[1]) @@ -184,6 +190,7 @@ def add_text( self._text_wrap.append(text_wrap) self._text_maxlen.append(text_maxlen) self._text_transform.append(text_transform) + self._text_scale.append(text_scale) self._text_scrolling.append(scrolling) self._text_line_spacing.append(line_spacing) @@ -262,11 +269,18 @@ def set_text(self, val, index=0): string = string[: self._text_maxlen[index]] print("text index", self._text[index]) index_in_splash = None + if self._text[index] is not None: - print("Replacing text area with :", string) + if self._debug: + print("Replacing text area with :", string) index_in_splash = self.splash.index(self._text[index]) + elif self._debug: + print("Creating text area with :", string) + if len(string) > 0: - self._text[index] = Label(self._text_font, text=string) + self._text[index] = Label( + self._text_font, text=string, scale=self._text_scale[index] + ) 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] diff --git a/docs/index.rst b/docs/index.rst index fd1cd47..8b689cc 100644 --- a/docs/index.rst +++ b/docs/index.rst @@ -23,13 +23,20 @@ Table of Contents .. toctree:: :caption: Tutorials + * Adafruit MatrixPortal M4 + .. toctree:: :caption: Related Products - * Adafruit Matrix Portal + * Adafruit MatrixPortal M4 * Adafruit Metro M4 Express AirLift * Adafruit RGB Matrix Shield + * Adafruit RGB Matrix Featherwing for M0/M4 + * Adafruit RGB Matrix FeatherWing for nrf52840 * 64x32 RGB LED Matrix + * 16x32 RGB LED Matrix + * 64x64 2.5mm pitch RGB LED Matrix + * 64x64 3mm pitch RGB LED Matrix .. toctree:: :caption: Other Links