Skip to content

Commit 5014b3d

Browse files
Refactor tilegrid
1 parent a001c02 commit 5014b3d

File tree

1 file changed

+12
-12
lines changed

1 file changed

+12
-12
lines changed

adafruit_display_text/bitmap_label.py

Lines changed: 12 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -190,7 +190,7 @@ def _reset_text(
190190
else:
191191
label_position_yoffset = self._ascent // 2
192192

193-
self.tilegrid = displayio.TileGrid(
193+
self._tilegrid = displayio.TileGrid(
194194
self._bitmap,
195195
pixel_shader=self._palette,
196196
width=1,
@@ -203,36 +203,36 @@ def _reset_text(
203203
)
204204

205205
if self._label_direction == "UPR":
206-
self.tilegrid.transpose_xy = True
207-
self.tilegrid.flip_x = True
206+
self._tilegrid.transpose_xy = True
207+
self._tilegrid.flip_x = True
208208
if self._label_direction == "DWR":
209-
self.tilegrid.transpose_xy = True
210-
self.tilegrid.flip_y = True
209+
self._tilegrid.transpose_xy = True
210+
self._tilegrid.flip_y = True
211211
if self._label_direction == "UPD":
212-
self.tilegrid.flip_x = True
213-
self.tilegrid.flip_y = True
212+
self._tilegrid.flip_x = True
213+
self._tilegrid.flip_y = True
214214

215215
# Clear out any items in the local_group Group, in case this is an update to
216216
# the bitmap_label
217217
for _ in self._local_group:
218218
self._local_group.pop(0)
219219
self._local_group.append(
220-
self.tilegrid
220+
self._tilegrid
221221
) # add the bitmap's tilegrid to the group
222222

223223
# Update bounding_box values. Note: To be consistent with label.py,
224224
# this is the bounding box for the text only, not including the background.
225225
if self._label_direction in ("UPR", "DWR"):
226226
self._bounding_box = (
227-
self.tilegrid.x,
228-
self.tilegrid.y,
227+
self._tilegrid.x,
228+
self._tilegrid.y,
229229
tight_box_y,
230230
box_x,
231231
)
232232
else:
233233
self._bounding_box = (
234-
self.tilegrid.x,
235-
self.tilegrid.y,
234+
self._tilegrid.x,
235+
self._tilegrid.y,
236236
box_x,
237237
tight_box_y,
238238
)

0 commit comments

Comments
 (0)