replace .show(x) with .root_group = x
This commit is contained in:
parent
44a84c575b
commit
24a0bdec05
16 changed files with 36 additions and 49 deletions
|
|
@ -230,7 +230,7 @@ class ClueLightPainter:
|
||||||
board.DISPLAY.root_group = group
|
board.DISPLAY.root_group = group
|
||||||
sleep(4)
|
sleep(4)
|
||||||
|
|
||||||
board.DISPLAY.show(displayio.Group()) # Clear display
|
board.DISPLAY.root_group = displayio.Group() # Clear display
|
||||||
self.clear_strip() # LEDs off
|
self.clear_strip() # LEDs off
|
||||||
|
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -444,7 +444,7 @@ class Plotter:
|
||||||
if self._displayio_graph is None:
|
if self._displayio_graph is None:
|
||||||
self._displayio_graph = self._make_empty_graph(tg_and_plot=tg_and_plot)
|
self._displayio_graph = self._make_empty_graph(tg_and_plot=tg_and_plot)
|
||||||
|
|
||||||
self._output.show(self._displayio_graph)
|
self._output.root_group = self._displayio_graph
|
||||||
|
|
||||||
def display_off(self):
|
def display_off(self):
|
||||||
pass
|
pass
|
||||||
|
|
|
||||||
|
|
@ -66,7 +66,7 @@ class Robot:
|
||||||
def _init_display(self):
|
def _init_display(self):
|
||||||
self.display = board.DISPLAY
|
self.display = board.DISPLAY
|
||||||
self.display_group = displayio.Group()
|
self.display_group = displayio.Group()
|
||||||
self.display.show(self.display_group)
|
self.display.root_group = self.display_group
|
||||||
self.shape_color = 0
|
self.shape_color = 0
|
||||||
self.bg_color = 0xFFFF00
|
self.bg_color = 0xFFFF00
|
||||||
rect = vectorio.Rectangle(
|
rect = vectorio.Rectangle(
|
||||||
|
|
|
||||||
|
|
@ -21,7 +21,7 @@ bg_palette[0] = 0xDDDD00
|
||||||
|
|
||||||
# Make the display context
|
# Make the display context
|
||||||
main_group = displayio.Group()
|
main_group = displayio.Group()
|
||||||
display.show(main_group)
|
display.root_group = main_group
|
||||||
|
|
||||||
font = bitmap_font.load_font("fonts/LeagueSpartan-Bold-16.bdf")
|
font = bitmap_font.load_font("fonts/LeagueSpartan-Bold-16.bdf")
|
||||||
reg_label = label.Label(
|
reg_label = label.Label(
|
||||||
|
|
|
||||||
|
|
@ -15,7 +15,7 @@ display = board.DISPLAY
|
||||||
|
|
||||||
# Make the display context
|
# Make the display context
|
||||||
main_group = displayio.Group()
|
main_group = displayio.Group()
|
||||||
display.show(main_group)
|
display.root_group = main_group
|
||||||
|
|
||||||
font = terminalio.FONT
|
font = terminalio.FONT
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -211,7 +211,7 @@ class Paint(object):
|
||||||
self._palette = self._make_palette()
|
self._palette = self._make_palette()
|
||||||
self._splash.append(self._palette)
|
self._splash.append(self._palette)
|
||||||
|
|
||||||
self._display.show(self._splash)
|
self._display.root_group = self._splash
|
||||||
try:
|
try:
|
||||||
gc.collect()
|
gc.collect()
|
||||||
self._display.refresh(target_frames_per_second=60)
|
self._display.refresh(target_frames_per_second=60)
|
||||||
|
|
|
||||||
|
|
@ -171,28 +171,15 @@ class Pyloton:
|
||||||
|
|
||||||
blinka_bitmap = "blinka-pyloton.bmp"
|
blinka_bitmap = "blinka-pyloton.bmp"
|
||||||
|
|
||||||
# Compatible with CircuitPython 6 & 7
|
bitmap1 = displayio.OnDiskBitmap(blinka_bitmap)
|
||||||
with open(blinka_bitmap, 'rb') as bitmap_file:
|
tile_grid = displayio.TileGrid(bitmap1, pixel_shader=bitmap1.pixel_shader)
|
||||||
bitmap1 = displayio.OnDiskBitmap(bitmap_file)
|
self.loading_group.append(tile_grid)
|
||||||
tile_grid = displayio.TileGrid(bitmap1, pixel_shader=getattr(bitmap1, 'pixel_shader', displayio.ColorConverter()))
|
self.display.root_group = self.loading_group
|
||||||
self.loading_group.append(tile_grid)
|
status_heading = label.Label(font=self.arial16, x=80, y=175,
|
||||||
self.display.show(self.loading_group)
|
text="Status", color=self.YELLOW)
|
||||||
status_heading = label.Label(font=self.arial16, x=80, y=175,
|
rect = Rect(0, 165, 240, 75, fill=self.PURPLE)
|
||||||
text="Status", color=self.YELLOW)
|
self.loading_group.append(rect)
|
||||||
rect = Rect(0, 165, 240, 75, fill=self.PURPLE)
|
self.loading_group.append(status_heading)
|
||||||
self.loading_group.append(rect)
|
|
||||||
self.loading_group.append(status_heading)
|
|
||||||
|
|
||||||
# # Compatible with CircuitPython 7+
|
|
||||||
# bitmap1 = displayio.OnDiskBitmap(blinka_bitmap)
|
|
||||||
# tile_grid = displayio.TileGrid(bitmap1, pixel_shader=bitmap1.pixel_shader)
|
|
||||||
# self.loading_group.append(tile_grid)
|
|
||||||
# self.display.show(self.loading_group)
|
|
||||||
# status_heading = label.Label(font=self.arial16, x=80, y=175,
|
|
||||||
# text="Status", color=self.YELLOW)
|
|
||||||
# rect = Rect(0, 165, 240, 75, fill=self.PURPLE)
|
|
||||||
# self.loading_group.append(rect)
|
|
||||||
# self.loading_group.append(status_heading)
|
|
||||||
|
|
||||||
def _load_fonts(self):
|
def _load_fonts(self):
|
||||||
"""
|
"""
|
||||||
|
|
@ -495,7 +482,7 @@ class Pyloton:
|
||||||
|
|
||||||
self.splash.append(sprites)
|
self.splash.append(sprites)
|
||||||
|
|
||||||
self.display.show(self.splash)
|
self.display.root_group = self.splash
|
||||||
while self.loading_group:
|
while self.loading_group:
|
||||||
self.loading_group.pop()
|
self.loading_group.pop()
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -72,7 +72,7 @@ text_group.append(text_area) # Add this text to the text group
|
||||||
g.append(text_group)
|
g.append(text_group)
|
||||||
|
|
||||||
# Place the display group on the screen
|
# Place the display group on the screen
|
||||||
display.show(g)
|
display.root_group = g
|
||||||
|
|
||||||
# Refresh the display to have everything show on the display
|
# Refresh the display to have everything show on the display
|
||||||
# NOTE: Do not refresh eInk displays more often than 180 seconds!
|
# NOTE: Do not refresh eInk displays more often than 180 seconds!
|
||||||
|
|
|
||||||
|
|
@ -74,7 +74,7 @@ fan_text = funhouse.add_text(
|
||||||
text_font="fonts/Arial-Bold-24.pcf",
|
text_font="fonts/Arial-Bold-24.pcf",
|
||||||
)
|
)
|
||||||
# showing graphics
|
# showing graphics
|
||||||
funhouse.display.show(funhouse.splash)
|
funhouse.display.root_group = funhouse.splash
|
||||||
|
|
||||||
# state machines
|
# state machines
|
||||||
run = False # state if main code is running
|
run = False # state if main code is running
|
||||||
|
|
|
||||||
|
|
@ -81,7 +81,7 @@ label_verification_url.text = (
|
||||||
label_user_code.text = "2. Enter code: %s" % google_auth.user_code
|
label_user_code.text = "2. Enter code: %s" % google_auth.user_code
|
||||||
|
|
||||||
graphics.qrcode(google_auth.verification_url.encode(), qr_size=2, x=240, y=70)
|
graphics.qrcode(google_auth.verification_url.encode(), qr_size=2, x=240, y=70)
|
||||||
graphics.display.show(graphics.splash)
|
graphics.display.root_group = graphics.splash
|
||||||
display.refresh()
|
display.refresh()
|
||||||
|
|
||||||
# Poll Google's authorization server
|
# Poll Google's authorization server
|
||||||
|
|
|
||||||
|
|
@ -269,7 +269,7 @@ def update_display_with_flight_data(flight_data, icon_group, display_group):
|
||||||
display_group.append(icon_group)
|
display_group.append(icon_group)
|
||||||
|
|
||||||
# Show the updated group on the display
|
# Show the updated group on the display
|
||||||
display.show(display_group)
|
display.root_group = display_group
|
||||||
display.refresh()
|
display.refresh()
|
||||||
return text_labels
|
return text_labels
|
||||||
|
|
||||||
|
|
@ -287,7 +287,7 @@ def display_no_flights():
|
||||||
main_group.append(looking_label)
|
main_group.append(looking_label)
|
||||||
|
|
||||||
# Update the display with the new group
|
# Update the display with the new group
|
||||||
display.show(main_group)
|
display.root_group = main_group
|
||||||
display.refresh()
|
display.refresh()
|
||||||
|
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -50,7 +50,7 @@ def update_display(text, color=0xFFFFFF):
|
||||||
text_area.x = display.width
|
text_area.x = display.width
|
||||||
text_area.y = 13
|
text_area.y = 13
|
||||||
main_group.append(text_area)
|
main_group.append(text_area)
|
||||||
display.show(main_group)
|
display.root_group = main_group
|
||||||
|
|
||||||
while True:
|
while True:
|
||||||
print("WAITING...")
|
print("WAITING...")
|
||||||
|
|
|
||||||
|
|
@ -78,7 +78,7 @@ label_user_code.text = "2. Enter code: %s" % google_auth.user_code
|
||||||
|
|
||||||
# Create a QR code
|
# Create a QR code
|
||||||
graphics.qrcode(google_auth.verification_url.encode(), qr_size=2, x=170, y=165)
|
graphics.qrcode(google_auth.verification_url.encode(), qr_size=2, x=170, y=165)
|
||||||
graphics.display.show(graphics.splash)
|
graphics.display.root_group = graphics.splash
|
||||||
|
|
||||||
# Poll Google's authorization server
|
# Poll Google's authorization server
|
||||||
print("Waiting for browser authorization...")
|
print("Waiting for browser authorization...")
|
||||||
|
|
|
||||||
|
|
@ -206,7 +206,7 @@ while True:
|
||||||
print("trash time")
|
print("trash time")
|
||||||
alarm = True
|
alarm = True
|
||||||
if alarm and not dismissed and not snoozed:
|
if alarm and not dismissed and not snoozed:
|
||||||
display.show(alarm_gfx[w])
|
display.root_group = alarm_gfx[w]
|
||||||
pyportal.play_file(alarm_sounds[w])
|
pyportal.play_file(alarm_sounds[w])
|
||||||
mode = w
|
mode = w
|
||||||
print("mode is:", mode)
|
print("mode is:", mode)
|
||||||
|
|
@ -216,7 +216,7 @@ while True:
|
||||||
if time_str == alarm_checks[a]:
|
if time_str == alarm_checks[a]:
|
||||||
alarm = True
|
alarm = True
|
||||||
if alarm and not dismissed and not snoozed:
|
if alarm and not dismissed and not snoozed:
|
||||||
display.show(alarm_gfx[a])
|
display.root_group = alarm_gfx[a]
|
||||||
pyportal.play_file(alarm_sounds[a])
|
pyportal.play_file(alarm_sounds[a])
|
||||||
mode = a
|
mode = a
|
||||||
print(mode)
|
print(mode)
|
||||||
|
|
@ -244,13 +244,13 @@ while True:
|
||||||
print("pressed dismiss button")
|
print("pressed dismiss button")
|
||||||
dismissed = True
|
dismissed = True
|
||||||
alarm = False
|
alarm = False
|
||||||
display.show(pyportal.splash)
|
display.root_group = pyportal.splash
|
||||||
touched = time.monotonic()
|
touched = time.monotonic()
|
||||||
mode = mode
|
mode = mode
|
||||||
if not switch_snooze.value and not phys_snooze:
|
if not switch_snooze.value and not phys_snooze:
|
||||||
phys_snooze = True
|
phys_snooze = True
|
||||||
print("pressed snooze button")
|
print("pressed snooze button")
|
||||||
display.show(pyportal.splash)
|
display.root_group = pyportal.splash
|
||||||
snoozed = True
|
snoozed = True
|
||||||
alarm = False
|
alarm = False
|
||||||
touched = time.monotonic()
|
touched = time.monotonic()
|
||||||
|
|
@ -265,7 +265,7 @@ while True:
|
||||||
if touch:
|
if touch:
|
||||||
if snooze_buttons[button_mode].contains(touch) and not touch_button_snooze:
|
if snooze_buttons[button_mode].contains(touch) and not touch_button_snooze:
|
||||||
print("Touched snooze")
|
print("Touched snooze")
|
||||||
display.show(pyportal.splash)
|
display.root_group = pyportal.splash
|
||||||
touch_button_snooze = True
|
touch_button_snooze = True
|
||||||
snoozed = True
|
snoozed = True
|
||||||
alarm = False
|
alarm = False
|
||||||
|
|
@ -275,7 +275,7 @@ while True:
|
||||||
print("Touched dismiss")
|
print("Touched dismiss")
|
||||||
dismissed = True
|
dismissed = True
|
||||||
alarm = False
|
alarm = False
|
||||||
display.show(pyportal.splash)
|
display.root_group = pyportal.splash
|
||||||
touch_button_dismiss = True
|
touch_button_dismiss = True
|
||||||
touched = time.monotonic()
|
touched = time.monotonic()
|
||||||
mode = mode
|
mode = mode
|
||||||
|
|
@ -294,6 +294,6 @@ while True:
|
||||||
snoozed = False
|
snoozed = False
|
||||||
alarm = True
|
alarm = True
|
||||||
mode = mode
|
mode = mode
|
||||||
display.show(alarm_gfx[mode])
|
display.root_group = alarm_gfx[mode]
|
||||||
pyportal.play_file(alarm_sounds[mode])
|
pyportal.play_file(alarm_sounds[mode])
|
||||||
print(mode)
|
print(mode)
|
||||||
|
|
|
||||||
|
|
@ -50,7 +50,7 @@ for i in range(len(images)):
|
||||||
index = 0
|
index = 0
|
||||||
touch_state = False
|
touch_state = False
|
||||||
|
|
||||||
display.show(groups[index])
|
display.root_group = groups[index]
|
||||||
|
|
||||||
while True:
|
while True:
|
||||||
if tsc.touched and not touch_state:
|
if tsc.touched and not touch_state:
|
||||||
|
|
@ -59,11 +59,11 @@ while True:
|
||||||
# left side of the screen
|
# left side of the screen
|
||||||
if point["y"] < 2000:
|
if point["y"] < 2000:
|
||||||
index = (index - 1) % len(images)
|
index = (index - 1) % len(images)
|
||||||
display.show(groups[index])
|
display.root_group = groups[index]
|
||||||
# right side of the screen
|
# right side of the screen
|
||||||
else:
|
else:
|
||||||
index = (index + 1) % len(images)
|
index = (index + 1) % len(images)
|
||||||
display.show(groups[index])
|
display.root_group = groups[index]
|
||||||
touch_state = True
|
touch_state = True
|
||||||
if not tsc.touched and touch_state:
|
if not tsc.touched and touch_state:
|
||||||
touch_state = False
|
touch_state = False
|
||||||
|
|
|
||||||
|
|
@ -54,7 +54,7 @@ for i in range(len(images)):
|
||||||
index = 0
|
index = 0
|
||||||
touch_state = False
|
touch_state = False
|
||||||
|
|
||||||
display.show(groups[index])
|
display.root_group = groups[index]
|
||||||
while True:
|
while True:
|
||||||
if tsc.touched and not touch_state:
|
if tsc.touched and not touch_state:
|
||||||
point = tsc.touch
|
point = tsc.touch
|
||||||
|
|
@ -65,10 +65,10 @@ while True:
|
||||||
# left side of the screen
|
# left side of the screen
|
||||||
if point["y"] < 2000:
|
if point["y"] < 2000:
|
||||||
index = (index - 1) % len(images)
|
index = (index - 1) % len(images)
|
||||||
display.show(groups[index])
|
display.root_group = groups[index]
|
||||||
# right side of the screen
|
# right side of the screen
|
||||||
else:
|
else:
|
||||||
index = (index + 1) % len(images)
|
index = (index + 1) % len(images)
|
||||||
display.show(groups[index])
|
display.root_group = groups[index]
|
||||||
if not tsc.touched and touch_state:
|
if not tsc.touched and touch_state:
|
||||||
touch_state = False
|
touch_state = False
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue