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
|
||||
sleep(4)
|
||||
|
||||
board.DISPLAY.show(displayio.Group()) # Clear display
|
||||
board.DISPLAY.root_group = displayio.Group() # Clear display
|
||||
self.clear_strip() # LEDs off
|
||||
|
||||
|
||||
|
|
|
|||
|
|
@ -444,7 +444,7 @@ class Plotter:
|
|||
if self._displayio_graph is None:
|
||||
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):
|
||||
pass
|
||||
|
|
|
|||
|
|
@ -66,7 +66,7 @@ class Robot:
|
|||
def _init_display(self):
|
||||
self.display = board.DISPLAY
|
||||
self.display_group = displayio.Group()
|
||||
self.display.show(self.display_group)
|
||||
self.display.root_group = self.display_group
|
||||
self.shape_color = 0
|
||||
self.bg_color = 0xFFFF00
|
||||
rect = vectorio.Rectangle(
|
||||
|
|
|
|||
|
|
@ -21,7 +21,7 @@ bg_palette[0] = 0xDDDD00
|
|||
|
||||
# Make the display context
|
||||
main_group = displayio.Group()
|
||||
display.show(main_group)
|
||||
display.root_group = main_group
|
||||
|
||||
font = bitmap_font.load_font("fonts/LeagueSpartan-Bold-16.bdf")
|
||||
reg_label = label.Label(
|
||||
|
|
|
|||
|
|
@ -15,7 +15,7 @@ display = board.DISPLAY
|
|||
|
||||
# Make the display context
|
||||
main_group = displayio.Group()
|
||||
display.show(main_group)
|
||||
display.root_group = main_group
|
||||
|
||||
font = terminalio.FONT
|
||||
|
||||
|
|
|
|||
|
|
@ -211,7 +211,7 @@ class Paint(object):
|
|||
self._palette = self._make_palette()
|
||||
self._splash.append(self._palette)
|
||||
|
||||
self._display.show(self._splash)
|
||||
self._display.root_group = self._splash
|
||||
try:
|
||||
gc.collect()
|
||||
self._display.refresh(target_frames_per_second=60)
|
||||
|
|
|
|||
|
|
@ -171,29 +171,16 @@ class Pyloton:
|
|||
|
||||
blinka_bitmap = "blinka-pyloton.bmp"
|
||||
|
||||
# Compatible with CircuitPython 6 & 7
|
||||
with open(blinka_bitmap, 'rb') as bitmap_file:
|
||||
bitmap1 = displayio.OnDiskBitmap(bitmap_file)
|
||||
tile_grid = displayio.TileGrid(bitmap1, pixel_shader=getattr(bitmap1, 'pixel_shader', displayio.ColorConverter()))
|
||||
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)
|
||||
self.display.root_group = 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)
|
||||
|
||||
# # 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):
|
||||
"""
|
||||
Loads fonts
|
||||
|
|
@ -495,7 +482,7 @@ class Pyloton:
|
|||
|
||||
self.splash.append(sprites)
|
||||
|
||||
self.display.show(self.splash)
|
||||
self.display.root_group = self.splash
|
||||
while self.loading_group:
|
||||
self.loading_group.pop()
|
||||
|
||||
|
|
|
|||
|
|
@ -72,7 +72,7 @@ text_group.append(text_area) # Add this text to the text group
|
|||
g.append(text_group)
|
||||
|
||||
# Place the display group on the screen
|
||||
display.show(g)
|
||||
display.root_group = g
|
||||
|
||||
# Refresh the display to have everything show on the display
|
||||
# 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",
|
||||
)
|
||||
# showing graphics
|
||||
funhouse.display.show(funhouse.splash)
|
||||
funhouse.display.root_group = funhouse.splash
|
||||
|
||||
# state machines
|
||||
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
|
||||
|
||||
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()
|
||||
|
||||
# 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)
|
||||
|
||||
# Show the updated group on the display
|
||||
display.show(display_group)
|
||||
display.root_group = display_group
|
||||
display.refresh()
|
||||
return text_labels
|
||||
|
||||
|
|
@ -287,7 +287,7 @@ def display_no_flights():
|
|||
main_group.append(looking_label)
|
||||
|
||||
# Update the display with the new group
|
||||
display.show(main_group)
|
||||
display.root_group = main_group
|
||||
display.refresh()
|
||||
|
||||
|
||||
|
|
|
|||
|
|
@ -50,7 +50,7 @@ def update_display(text, color=0xFFFFFF):
|
|||
text_area.x = display.width
|
||||
text_area.y = 13
|
||||
main_group.append(text_area)
|
||||
display.show(main_group)
|
||||
display.root_group = main_group
|
||||
|
||||
while True:
|
||||
print("WAITING...")
|
||||
|
|
|
|||
|
|
@ -78,7 +78,7 @@ label_user_code.text = "2. Enter code: %s" % google_auth.user_code
|
|||
|
||||
# Create a QR code
|
||||
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
|
||||
print("Waiting for browser authorization...")
|
||||
|
|
|
|||
|
|
@ -206,7 +206,7 @@ while True:
|
|||
print("trash time")
|
||||
alarm = True
|
||||
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])
|
||||
mode = w
|
||||
print("mode is:", mode)
|
||||
|
|
@ -216,7 +216,7 @@ while True:
|
|||
if time_str == alarm_checks[a]:
|
||||
alarm = True
|
||||
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])
|
||||
mode = a
|
||||
print(mode)
|
||||
|
|
@ -244,13 +244,13 @@ while True:
|
|||
print("pressed dismiss button")
|
||||
dismissed = True
|
||||
alarm = False
|
||||
display.show(pyportal.splash)
|
||||
display.root_group = pyportal.splash
|
||||
touched = time.monotonic()
|
||||
mode = mode
|
||||
if not switch_snooze.value and not phys_snooze:
|
||||
phys_snooze = True
|
||||
print("pressed snooze button")
|
||||
display.show(pyportal.splash)
|
||||
display.root_group = pyportal.splash
|
||||
snoozed = True
|
||||
alarm = False
|
||||
touched = time.monotonic()
|
||||
|
|
@ -265,7 +265,7 @@ while True:
|
|||
if touch:
|
||||
if snooze_buttons[button_mode].contains(touch) and not touch_button_snooze:
|
||||
print("Touched snooze")
|
||||
display.show(pyportal.splash)
|
||||
display.root_group = pyportal.splash
|
||||
touch_button_snooze = True
|
||||
snoozed = True
|
||||
alarm = False
|
||||
|
|
@ -275,7 +275,7 @@ while True:
|
|||
print("Touched dismiss")
|
||||
dismissed = True
|
||||
alarm = False
|
||||
display.show(pyportal.splash)
|
||||
display.root_group = pyportal.splash
|
||||
touch_button_dismiss = True
|
||||
touched = time.monotonic()
|
||||
mode = mode
|
||||
|
|
@ -294,6 +294,6 @@ while True:
|
|||
snoozed = False
|
||||
alarm = True
|
||||
mode = mode
|
||||
display.show(alarm_gfx[mode])
|
||||
display.root_group = alarm_gfx[mode]
|
||||
pyportal.play_file(alarm_sounds[mode])
|
||||
print(mode)
|
||||
|
|
|
|||
|
|
@ -50,7 +50,7 @@ for i in range(len(images)):
|
|||
index = 0
|
||||
touch_state = False
|
||||
|
||||
display.show(groups[index])
|
||||
display.root_group = groups[index]
|
||||
|
||||
while True:
|
||||
if tsc.touched and not touch_state:
|
||||
|
|
@ -59,11 +59,11 @@ while True:
|
|||
# left side of the screen
|
||||
if point["y"] < 2000:
|
||||
index = (index - 1) % len(images)
|
||||
display.show(groups[index])
|
||||
display.root_group = groups[index]
|
||||
# right side of the screen
|
||||
else:
|
||||
index = (index + 1) % len(images)
|
||||
display.show(groups[index])
|
||||
display.root_group = groups[index]
|
||||
touch_state = True
|
||||
if not tsc.touched and touch_state:
|
||||
touch_state = False
|
||||
|
|
|
|||
|
|
@ -54,7 +54,7 @@ for i in range(len(images)):
|
|||
index = 0
|
||||
touch_state = False
|
||||
|
||||
display.show(groups[index])
|
||||
display.root_group = groups[index]
|
||||
while True:
|
||||
if tsc.touched and not touch_state:
|
||||
point = tsc.touch
|
||||
|
|
@ -65,10 +65,10 @@ while True:
|
|||
# left side of the screen
|
||||
if point["y"] < 2000:
|
||||
index = (index - 1) % len(images)
|
||||
display.show(groups[index])
|
||||
display.root_group = groups[index]
|
||||
# right side of the screen
|
||||
else:
|
||||
index = (index + 1) % len(images)
|
||||
display.show(groups[index])
|
||||
display.root_group = groups[index]
|
||||
if not tsc.touched and touch_state:
|
||||
touch_state = False
|
||||
|
|
|
|||
Loading…
Reference in a new issue