Skip to content

Commit 39431ec

Browse files
committed
undo ide formatting changes
1 parent cefd454 commit 39431ec

File tree

1 file changed

+12
-13
lines changed

1 file changed

+12
-13
lines changed

adafruit_display_text/label.py

Lines changed: 12 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -44,7 +44,6 @@
4444
__version__ = "0.0.0-auto.0"
4545
__repo__ = "https://github.com/adafruit/Adafruit_CircuitPython_Display_Text.git"
4646

47-
4847
class Label(displayio.Group):
4948
"""A label displaying a string of text. The origin point set by ``x`` and ``y``
5049
properties will be the left edge of the bounding box, and in the center of a M
@@ -57,7 +56,6 @@ class Label(displayio.Group):
5756
:param int max_glyphs: The largest quantity of glyphs we will display
5857
:param int color: Color of all text in RGB hex
5958
:param double line_spacing: Line spacing of text to display"""
60-
6159
def __init__(self, font, *, x=0, y=0, text=None, max_glyphs=None, color=0xffffff,
6260
backgroud_color=False, line_spacing=1.25, **kwargs):
6361
if not max_glyphs and not text:
@@ -87,14 +85,15 @@ def __init__(self, font, *, x=0, y=0, text=None, max_glyphs=None, color=0xffffff
8785
if text is not None:
8886
self._update_text(str(text))
8987

90-
def _update_text(self, new_text): # pylint: disable=too-many-locals
88+
89+
def _update_text(self, new_text): # pylint: disable=too-many-locals
9190
x = 0
9291
y = 0
9392
i = 0
9493
old_c = 0
9594
y_offset = int((self.font.get_glyph(ord('M')).height -
9695
new_text.count('\n') * self.height * self.line_spacing) / 2)
97-
# print("y offset from baseline", y_offset)
96+
#print("y offset from baseline", y_offset)
9897
left = right = top = bottom = 0
9998
for character in new_text:
10099
if character == '\n':
@@ -104,10 +103,10 @@ def _update_text(self, new_text): # pylint: disable=too-many-locals
104103
glyph = self.font.get_glyph(ord(character))
105104
if not glyph:
106105
continue
107-
right = max(right, x + glyph.width)
108-
if y == 0: # first line, find the Ascender height
109-
top = min(top, -glyph.height + y_offset)
110-
bottom = max(bottom, y - glyph.dy + y_offset)
106+
right = max(right, x+glyph.width)
107+
if y == 0: # first line, find the Ascender height
108+
top = min(top, -glyph.height+y_offset)
109+
bottom = max(bottom, y-glyph.dy+y_offset)
111110
position_y = y - glyph.height - glyph.dy + y_offset
112111
position_x = x + glyph.dx
113112
if not self._text or old_c >= len(self._text) or character != self._text[old_c]:
@@ -145,7 +144,7 @@ def _update_text(self, new_text): # pylint: disable=too-many-locals
145144
while len(self) > i:
146145
self.pop()
147146
self._text = new_text
148-
self._boundingbox = (left, top, left + right, bottom - top)
147+
self._boundingbox = (left, top, left+right, bottom-top)
149148

150149
@property
151150
def bounding_box(self):
@@ -196,10 +195,10 @@ def anchor_point(self, new_anchor_point):
196195
def anchored_position(self):
197196
"""Position relative to the anchor_point. Tuple containing x,y
198197
pixel coordinates."""
199-
return (self.x - self._boundingbox[2] * self._anchor_point[0],
200-
self.y - self._boundingbox[3] * self._anchor_point[1])
198+
return (self.x-self._boundingbox[2]*self._anchor_point[0],
199+
self.y-self._boundingbox[3]*self._anchor_point[1])
201200

202201
@anchored_position.setter
203202
def anchored_position(self, new_position):
204-
self.x = int(new_position[0] - (self._boundingbox[2] * self._anchor_point[0]))
205-
self.y = int(new_position[1] - (self._boundingbox[3] * self._anchor_point[1]))
203+
self.x = int(new_position[0]-(self._boundingbox[2]*self._anchor_point[0]))
204+
self.y = int(new_position[1]-(self._boundingbox[3]*self._anchor_point[1]))

0 commit comments

Comments
 (0)