From f23f66d287fe6c33d599f5a76a15220e764f11d7 Mon Sep 17 00:00:00 2001 From: Mike Renfro Date: Sat, 23 Mar 2019 21:28:26 -0500 Subject: [PATCH 1/2] Enabling users to set line spacing for multi-line labels --- adafruit_display_text/label.py | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/adafruit_display_text/label.py b/adafruit_display_text/label.py index 567f14f..d0fd6cb 100644 --- a/adafruit_display_text/label.py +++ b/adafruit_display_text/label.py @@ -53,8 +53,9 @@ class Label(displayio.Group): :param Font font: A font class that has ``get_bounding_box`` and ``get_glyph`` :param str text: Text to display :param int max_glyphs: The largest quantity of glyphs we will display - :param int color: Color of all text in RGB hex""" - def __init__(self, font, *, text=None, max_glyphs=None, color=0xffffff, **kwargs): + :param int color: Color of all text in RGB hex + :param double line_spacing: Line spacing of text to display""" + def __init__(self, font, *, text=None, max_glyphs=None, color=0xffffff, line_spacing=1.25, **kwargs): if not max_glyphs and not text: raise RuntimeError("Please provide a max size, or initial text") if not max_glyphs: @@ -70,7 +71,7 @@ def __init__(self, font, *, text=None, max_glyphs=None, color=0xffffff, **kwargs bounds = self.font.get_bounding_box() self.height = bounds[1] - self._line_spacing = 1.25 + self._line_spacing = line_spacing self._boundingbox = None if text: From 8f731e1ccfe97376e0a2fa3696de643dceade844 Mon Sep 17 00:00:00 2001 From: Mike Renfro Date: Sat, 23 Mar 2019 21:40:14 -0500 Subject: [PATCH 2/2] Fixing Travis pylint error Line too long --- adafruit_display_text/label.py | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/adafruit_display_text/label.py b/adafruit_display_text/label.py index d0fd6cb..1c2838a 100644 --- a/adafruit_display_text/label.py +++ b/adafruit_display_text/label.py @@ -55,7 +55,8 @@ class Label(displayio.Group): :param int max_glyphs: The largest quantity of glyphs we will display :param int color: Color of all text in RGB hex :param double line_spacing: Line spacing of text to display""" - def __init__(self, font, *, text=None, max_glyphs=None, color=0xffffff, line_spacing=1.25, **kwargs): + def __init__(self, font, *, text=None, max_glyphs=None, color=0xffffff, + line_spacing=1.25, **kwargs): if not max_glyphs and not text: raise RuntimeError("Please provide a max size, or initial text") if not max_glyphs: