From 4436be5cb2cb01ff83a52c08c5ec4a3f75084076 Mon Sep 17 00:00:00 2001 From: foamyguy Date: Mon, 13 Mar 2023 16:29:08 -0500 Subject: [PATCH] override text property from parent on ScrollingLabel so that its API functionality matches Label and BitmapLabel more closely --- adafruit_display_text/scrolling_label.py | 18 +++++++++++++++--- 1 file changed, 15 insertions(+), 3 deletions(-) diff --git a/adafruit_display_text/scrolling_label.py b/adafruit_display_text/scrolling_label.py index c2d52de..9fca81b 100644 --- a/adafruit_display_text/scrolling_label.py +++ b/adafruit_display_text/scrolling_label.py @@ -86,7 +86,7 @@ def update(self, force: bool = False) -> None: if force or self._last_animate_time + self.animate_time <= _now: if len(self.full_text) <= self.max_characters: - self.text = self.full_text + super()._set_text(self.full_text, self.scale) self._last_animate_time = _now return @@ -106,8 +106,7 @@ def update(self, force: bool = False) -> None: _showing_string = "{}{}".format( _showing_string_start, _showing_string_end ) - self.text = _showing_string - + super()._set_text(_showing_string, self.scale) self.current_index += 1 self._last_animate_time = _now @@ -144,3 +143,16 @@ def full_text(self, new_text: str) -> None: self._full_text = new_text self.current_index = 0 self.update() + + @property + def text(self): + """The full text to be shown. If it's longer than ``max_characters`` then + scrolling will occur as needed. + + :return str: The full text of this label. + """ + return self.full_text + + @text.setter + def text(self, new_text): + self.full_text = new_text