Skip to content

Commit d0baee4

Browse files
committed
# TODO Label Exceptions corrections
1 parent 69909e7 commit d0baee4

File tree

3 files changed

+6
-2
lines changed

3 files changed

+6
-2
lines changed

adafruit_display_text/__init__.py

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -235,8 +235,6 @@ def __init__(
235235

236236
self._text = text
237237

238-
if label_direction not in ["LTR", "RTL", "UPR", "DWR", "TTB"]:
239-
raise RuntimeError("Please provide a valid text direction")
240238
self._label_direction = label_direction
241239

242240
self.baseline = -1.0

adafruit_display_text/bitmap_label.py

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -108,6 +108,9 @@ def __init__(self, font, **kwargs) -> None:
108108
self.background_color = kwargs.get("background_color", None)
109109
self._label_direction = kwargs.get("label_direction", "LTR")
110110

111+
if self._label_direction not in ["LTR", "RTL", "UPD", "UPR", "DWR"]:
112+
raise RuntimeError("Please provide a valid text direction")
113+
111114
if self._label_direction == "RTL":
112115
self._text = "".join(reversed(self._text))
113116

adafruit_display_text/label.py

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -127,6 +127,9 @@ def __init__(self, font, **kwargs) -> None:
127127
self.base_alignment = kwargs.get("base_alignment", False)
128128
self._label_direction = kwargs.get("label_direction", "LTR")
129129

130+
if self._label_direction not in ["LTR", "RTL", "UPR", "DWR", "TTB"]:
131+
raise RuntimeError("Please provide a valid text direction")
132+
130133
if text is not None:
131134
self._update_text(str(text))
132135
if (kwargs.get("anchored_position", None) is not None) and (

0 commit comments

Comments
 (0)