Skip to content

Commit cc067a3

Browse files
authored
Update how board.DISPLAY is checked
Historically, boards with no built-in display have not had a `board.DISPLAY` property. Soon, with adafruit/circuitpython#10028, any board with displayio will have a `board.DISPLAY` property. This property will be `None` if no display is configured, or a truthy non-`None` value if a display is configured (including dynamically at runtime). This revised check will work on both old and new circuitpython versions.
1 parent a896875 commit cc067a3

File tree

1 file changed

+2
-4
lines changed

1 file changed

+2
-4
lines changed

adafruit_displayio_layout/layouts/tab_layout.py

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -87,10 +87,8 @@ def __init__(
8787
):
8888
if display is None:
8989
# pylint: disable=import-outside-toplevel
90-
import board
91-
92-
if hasattr(board, "DISPLAY"):
93-
display = board.DISPLAY
90+
import board
91+
display = getattr(board, "DISPLAY", None)
9492
if inactive_tab_spritesheet is None:
9593
raise AttributeError("Must pass inactive_tab_spritesheet")
9694
if showing_tab_spritesheet is None:

0 commit comments

Comments
 (0)