Skip to content

Commit b13a29c

Browse files
committed
fixes for pylint
1 parent 1425ae1 commit b13a29c

File tree

3 files changed

+38
-8
lines changed

3 files changed

+38
-8
lines changed

adafruit_display_text/__init__.py

Lines changed: 34 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -145,13 +145,45 @@ def chunks(lst, n):
145145

146146

147147
class LabelBase(Group):
148+
"""Super class that all other types of labels will extend. This contains
149+
all of the properties and functions that work the same way in all labels.
150+
151+
subclasses should implement _set_text, _set_font, and _set_line_spacing to
152+
have the correct behavior fo rthat type of label.
153+
154+
:param Font font: A font class that has ``get_bounding_box`` and ``get_glyph``.
155+
Must include a capital M for measuring character size.
156+
:param str text: Text to display
157+
:param int max_glyphs: Unnecessary parameter (provided only for direct compability
158+
with label.py)
159+
:param int color: Color of all text in RGB hex
160+
:param int background_color: Color of the background, use `None` for transparent
161+
:param double line_spacing: Line spacing of text to display
162+
:param boolean background_tight: Set `True` only if you want background box to tightly
163+
surround text. When set to 'True' Padding parameters will be ignored.
164+
:param int padding_top: Additional pixels added to background bounding box at top
165+
:param int padding_bottom: Additional pixels added to background bounding box at bottom
166+
:param int padding_left: Additional pixels added to background bounding box at left
167+
:param int padding_right: Additional pixels added to background bounding box at right
168+
:param (float,float) anchor_point: Point that anchored_position moves relative to.
169+
Tuple with decimal percentage of width and height.
170+
(E.g. (0,0) is top left, (1.0, 0.5): is middle right.)
171+
:param (int,int) anchored_position: Position relative to the anchor_point. Tuple
172+
containing x,y pixel coordinates.
173+
:param int scale: Integer value of the pixel scaling
174+
:param bool save_text: Set True to save the text string as a constant in the
175+
label structure. Set False to reduce memory use.
176+
:param: bool base_alignment: when True allows to align text label to the baseline.
177+
This is helpful when two or more labels need to be aligned to the same baseline"""
178+
179+
# pylint: disable=unused-argument, too-many-instance-attributes, too-many-locals, too-many-arguments
148180
def __init__(
149181
self,
150182
font,
151183
x=0,
152184
y=0,
153185
text="",
154-
max_glyphs=None, # This input parameter is ignored, only present for compatibility
186+
max_glyphs=None,
155187
# with label.py
156188
color=0xFFFFFF,
157189
background_color=None,
@@ -296,7 +328,7 @@ def scale(self, new_scale):
296328
self.local_group.scale = new_scale
297329
self.anchored_position = self._anchored_position # update the anchored_position
298330

299-
def _set_text(self, text, scale):
331+
def _set_text(self, new_text, scale):
300332
# subclasses should override this
301333
pass
302334

adafruit_display_text/bitmap_label.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -528,4 +528,4 @@ def _set_font(self, new_font):
528528
raise RuntimeError("font is immutable when save_text is False")
529529

530530
def _set_text(self, new_text, scale):
531-
self._reset_text(text=new_text, scale=self.scale)
531+
self._reset_text(text=new_text, scale=self.scale)

adafruit_display_text/label.py

Lines changed: 3 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -123,7 +123,6 @@ def __init__(self, font, **kwargs):
123123
self.base_alignment = kwargs.get("base_alignment", False)
124124

125125
if text is not None:
126-
print("calling _update_text")
127126
self._update_text(str(text))
128127
if (kwargs.get("anchored_position", None) is not None) and (
129128
kwargs.get("anchor_point", None) is not None
@@ -300,13 +299,12 @@ def _update_text(
300299
while len(self.local_group) > tilegrid_count: # i:
301300
self.local_group.pop()
302301
self._text = new_text
303-
print("setting bounding box")
304302
self._bounding_box = (left, top, right - left, bottom - top)
305303

306304
if self.background_color is not None:
307305
self._update_background_color(self._background_color)
308306

309-
def _reset_text(self, new_text, scale):
307+
def _reset_text(self, new_text):
310308
try:
311309
current_anchored_position = self.anchored_position
312310
self._update_text(str(new_text))
@@ -327,5 +325,5 @@ def _set_line_spacing(self, new_line_spacing):
327325
self._line_spacing = new_line_spacing
328326
self.text = self._text # redraw the box
329327

330-
def _set_text(self, text, scale):
331-
self._reset_text(text, scale)
328+
def _set_text(self, new_text, scale):
329+
self._reset_text(new_text)

0 commit comments

Comments
 (0)