change deprecated splash usage to root_group

This commit is contained in:
foamyguy 2025-07-25 16:46:08 -05:00
parent c5510041a3
commit 989db55caf
48 changed files with 107 additions and 107 deletions

View file

@ -56,7 +56,7 @@ icon2 = displayio.TileGrid(bitmap5, pixel_shader=palette5, x = 2, y = 2)
group = displayio.Group() group = displayio.Group()
# adding start-up bitmap to group # adding start-up bitmap to group
group.append(tile_grid) group.append(tile_grid)
funhouse.splash.append(group) funhouse.graphics.root_group.append(group)
# text for fume data # text for fume data
fume_text = funhouse.add_text( fume_text = funhouse.add_text(
text=" ", text=" ",
@ -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.root_group = funhouse.splash funhouse.display.root_group = funhouse.graphics.root_group
# state machines # state machines
run = False # state if main code is running run = False # state if main code is running

View file

@ -65,10 +65,10 @@ pres_label = funhouse.add_text(
) )
# Now display the splash to draw all labels at once # Now display the splash to draw all labels at once
funhouse.display.root_group = funhouse.splash funhouse.display.root_group = funhouse.graphics.root_group
status = Circle(229, 10, 10, fill=0xFF0000, outline=0x880000) status = Circle(229, 10, 10, fill=0xFF0000, outline=0x880000)
funhouse.splash.append(status) funhouse.graphics.root_group.append(status)
def connected(client, _userdata, _result, _payload): def connected(client, _userdata, _result, _payload):
status.fill = 0x00FF00 status.fill = 0x00FF00

View file

@ -77,7 +77,7 @@ time_label = funhouse.add_text(
text=trip_time, text_scale=2, text_position=(30, 25), text_color=0x606060 text=trip_time, text_scale=2, text_position=(30, 25), text_color=0x606060
) )
funhouse.display.root_group = funhouse.splash funhouse.display.root_group = funhouse.graphics.root_group
# Turn on the light # Turn on the light
print("Turning on light...") print("Turning on light...")

View file

@ -31,7 +31,7 @@ mail_label = funhouse.add_text(
) )
reset_label = funhouse.add_text(text="reset", text_position=(3, 70), text_color=GRAY) reset_label = funhouse.add_text(text="reset", text_position=(3, 70), text_color=GRAY)
funhouse.display.root_group = funhouse.splash funhouse.display.root_group = funhouse.graphics.root_group
def send_io_data(mail_value): def send_io_data(mail_value):

View file

@ -82,10 +82,10 @@ countdown_label = funhouse.add_text(
text_color=0xFFFF00, text_color=0xFFFF00,
text_font="fonts/Arial-Bold-24.pcf", text_font="fonts/Arial-Bold-24.pcf",
) )
funhouse.display.root_group = funhouse.splash funhouse.display.root_group = funhouse.graphics.root_group
status = Circle(229, 10, 10, fill=0xFF0000, outline=0x880000) status = Circle(229, 10, 10, fill=0xFF0000, outline=0x880000)
funhouse.splash.append(status) funhouse.graphics.root_group.append(status)
# Initialize a new MQTT Client object # Initialize a new MQTT Client object
if USE_MQTT: if USE_MQTT:

View file

@ -77,10 +77,10 @@ level_label = funhouse.add_text(
text_color=0xFFFF00, text_color=0xFFFF00,
text_font="fonts/Arial-Bold-24.pcf", text_font="fonts/Arial-Bold-24.pcf",
) )
funhouse.display.root_group = funhouse.splash funhouse.display.root_group = funhouse.graphics.root_group
status = Circle(229, 10, 10, fill=0xFF0000, outline=0x880000) status = Circle(229, 10, 10, fill=0xFF0000, outline=0x880000)
funhouse.splash.append(status) funhouse.graphics.root_group.append(status)
# Initialize a new MQTT Client object # Initialize a new MQTT Client object
funhouse.network.init_mqtt( funhouse.network.init_mqtt(

View file

@ -65,8 +65,8 @@ progress_bar_1 = ProgressBar(
BAR_X, 95, BAR_WIDTH, BAR_HEIGHT, 1.0, bar_color=0x999999, outline_color=0x000000 BAR_X, 95, BAR_WIDTH, BAR_HEIGHT, 1.0, bar_color=0x999999, outline_color=0x000000
) )
magtag.graphics.splash.append(progress_bar) magtag.graphics.root_group.append(progress_bar)
magtag.graphics.splash.append(progress_bar_1) magtag.graphics.root_group.append(progress_bar_1)
magtag.graphics.set_background("/bmps/background.bmp") magtag.graphics.set_background("/bmps/background.bmp")

View file

@ -40,7 +40,7 @@ for i in range(list_len):
# Add button labels at the bottom of the screen # Add button labels at the bottom of the screen
BUTTON_TEXT_IDX = list_len BUTTON_TEXT_IDX = list_len
magtag.graphics.splash.append(Rect(0, magtag.graphics.display.height - 14, magtag.graphics.root_group.append(Rect(0, magtag.graphics.display.height - 14,
magtag.graphics.display.width, magtag.graphics.display.width,
magtag.graphics.display.height, fill=0x0)) magtag.graphics.display.height, fill=0x0))
magtag.add_text( magtag.add_text(

View file

@ -32,7 +32,7 @@ graphics = Graphics(auto_refresh=False)
display = graphics.display display = graphics.display
background = Rect(0, 0, 296, 128, fill=0xFFFFFF) background = Rect(0, 0, 296, 128, fill=0xFFFFFF)
graphics.splash.append(background) graphics.root_group.append(background)
label_overview_text = Label( label_overview_text = Label(
font_large, font_large,
@ -42,18 +42,18 @@ label_overview_text = Label(
color=0x000000, color=0x000000,
text="Authorize this device with Google:", text="Authorize this device with Google:",
) )
graphics.splash.append(label_overview_text) graphics.root_group.append(label_overview_text)
label_verification_url = Label(font_small, x=0, y=40, line_spacing=0.75, color=0x000000) label_verification_url = Label(font_small, x=0, y=40, line_spacing=0.75, color=0x000000)
graphics.splash.append(label_verification_url) graphics.root_group.append(label_verification_url)
label_user_code = Label(font_small, x=0, y=80, color=0x000000, line_spacing=0.75) label_user_code = Label(font_small, x=0, y=80, color=0x000000, line_spacing=0.75)
graphics.splash.append(label_user_code) graphics.root_group.append(label_user_code)
label_qr_code = Label( label_qr_code = Label(
font_small, x=0, y=100, color=0x000000, text="Or scan the QR code:" font_small, x=0, y=100, color=0x000000, text="Or scan the QR code:"
) )
graphics.splash.append(label_qr_code) graphics.root_group.append(label_qr_code)
# Set scope(s) of access required by the API you're using # Set scope(s) of access required by the API you're using
scopes = ["https://www.googleapis.com/auth/calendar.readonly"] scopes = ["https://www.googleapis.com/auth/calendar.readonly"]
@ -85,7 +85,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.root_group = graphics.splash graphics.display.root_group = graphics.root_group
display.refresh() display.refresh()
# Poll Google's authorization server # Poll Google's authorization server
@ -98,9 +98,9 @@ print("Add the following lines to your settings.toml file:")
print(f'google_access_token="{google_auth.access_token}"') print(f'google_access_token="{google_auth.access_token}"')
print(f'google_refresh_token="{google_auth.refresh_token}"') print(f'google_refresh_token="{google_auth.refresh_token}"')
graphics.splash.pop() graphics.root_group.pop()
graphics.splash.pop() graphics.root_group.pop()
graphics.splash.pop() graphics.root_group.pop()
label_overview_text.text = "Successfully Authenticated!" label_overview_text.text = "Successfully Authenticated!"
label_verification_url.text = ( label_verification_url.text = (

View file

@ -205,7 +205,7 @@ magtag.set_background(0xFFFFFF)
# Add the header # Add the header
line_header = Line(0, 30, 320, 30, color=0x000000) line_header = Line(0, 30, 320, 30, color=0x000000)
magtag.splash.append(line_header) magtag.graphics.root_group.append(line_header)
label_header = magtag.add_text( label_header = magtag.add_text(
text_font="fonts/Arial-18.pcf", text_font="fonts/Arial-18.pcf",

View file

@ -60,7 +60,7 @@ MAGTAG.add_text(
# Add 14-pixel-tall black bar at bottom of display. It's a distinct layer # Add 14-pixel-tall black bar at bottom of display. It's a distinct layer
# (not just background) to appear on top of name list if it runs long. # (not just background) to appear on top of name list if it runs long.
MAGTAG.graphics.splash.append(Rect(0, MAGTAG.graphics.display.height - 14, MAGTAG.graphics.root_group.append(Rect(0, MAGTAG.graphics.display.height - 14,
MAGTAG.graphics.display.width, MAGTAG.graphics.display.width,
MAGTAG.graphics.display.height, fill=0x0)) MAGTAG.graphics.display.height, fill=0x0))

View file

@ -69,7 +69,7 @@ MAGTAG.add_text(
# Add 14-pixel-tall black bar at bottom of display. It's a distinct layer # Add 14-pixel-tall black bar at bottom of display. It's a distinct layer
# (not just background) to appear on top of task list if it runs long. # (not just background) to appear on top of task list if it runs long.
MAGTAG.graphics.splash.append(Rect(0, MAGTAG.graphics.display.height - 14, MAGTAG.graphics.root_group.append(Rect(0, MAGTAG.graphics.display.height - 14,
MAGTAG.graphics.display.width, MAGTAG.graphics.display.width,
MAGTAG.graphics.display.height, fill=0x0)) MAGTAG.graphics.display.height, fill=0x0))

View file

@ -75,7 +75,7 @@ progress_bar = ProgressBar(
BAR_X, BAR_Y, BAR_WIDTH, BAR_HEIGHT, 1.0, bar_color=0x999999, outline_color=0x000000 BAR_X, BAR_Y, BAR_WIDTH, BAR_HEIGHT, 1.0, bar_color=0x999999, outline_color=0x000000
) )
magtag.graphics.splash.append(progress_bar) magtag.graphics.root_group.append(progress_bar)
timestamp = None timestamp = None

View file

@ -53,7 +53,7 @@ progress_bar = ProgressBar(
BAR_X, BAR_Y, BAR_WIDTH, BAR_HEIGHT, 1.0, bar_color=0x999999, outline_color=0x000000 BAR_X, BAR_Y, BAR_WIDTH, BAR_HEIGHT, 1.0, bar_color=0x999999, outline_color=0x000000
) )
magtag.graphics.splash.append(progress_bar) magtag.graphics.root_group.append(progress_bar)
try: try:

View file

@ -78,7 +78,7 @@ MAGTAG.add_text(
# Add 14-pixel-tall black bar at bottom of display. It's a distinct layer # Add 14-pixel-tall black bar at bottom of display. It's a distinct layer
# (not just background) to appear on top of produce list if it runs long. # (not just background) to appear on top of produce list if it runs long.
MAGTAG.graphics.splash.append(Rect(0, MAGTAG.graphics.display.height - 14, MAGTAG.graphics.root_group.append(Rect(0, MAGTAG.graphics.display.height - 14,
MAGTAG.graphics.display.width, MAGTAG.graphics.display.width,
MAGTAG.graphics.display.height, fill=0x0)) MAGTAG.graphics.display.height, fill=0x0))

View file

@ -130,12 +130,12 @@ station_info.anchored_position = (158, 126)
# ---------------------------- # ----------------------------
# Add all the graphic layers # Add all the graphic layers
# ---------------------------- # ----------------------------
magtag.splash.append(tide_tg) magtag.graphics.root_group.append(tide_tg)
magtag.splash.append(grid_overlay) magtag.graphics.root_group.append(grid_overlay)
magtag.splash.append(plot_y_labels) magtag.graphics.root_group.append(plot_y_labels)
magtag.splash.append(tide_info) magtag.graphics.root_group.append(tide_info)
magtag.splash.append(date_label) magtag.graphics.root_group.append(date_label)
magtag.splash.append(station_info) magtag.graphics.root_group.append(station_info)
# ///////////////////////////////////////////////////////////////////////// # /////////////////////////////////////////////////////////////////////////

View file

@ -344,9 +344,9 @@ future_banners = [
make_banner(x=210, y=81), make_banner(x=210, y=81),
] ]
magtag.splash.append(today_banner) magtag.graphics.root_group.append(today_banner)
for future_banner in future_banners: for future_banner in future_banners:
magtag.splash.append(future_banner) magtag.graphics.root_group.append(future_banner)
# =========== # ===========
# M A I N # M A I N

View file

@ -283,9 +283,9 @@ future_banners = [
make_banner(x=210, y=102), make_banner(x=210, y=102),
] ]
magtag.splash.append(today_banner) magtag.graphics.root_group.append(today_banner)
for future_banner in future_banners: for future_banner in future_banners:
magtag.splash.append(future_banner) magtag.graphics.root_group.append(future_banner)
# =========== # ===========
# M A I N # M A I N

View file

@ -280,9 +280,9 @@ future_banners = [
make_banner(x=210, y=102), make_banner(x=210, y=102),
] ]
magtag.splash.append(today_banner) magtag.graphics.root_group.append(today_banner)
for future_banner in future_banners: for future_banner in future_banners:
magtag.splash.append(future_banner) magtag.graphics.root_group.append(future_banner)
# =========== # ===========
# M A I N # M A I N

View file

@ -136,8 +136,8 @@ def create_text_areas(configs):
def clear_splash(): def clear_splash():
for _ in range(len(pyportal.splash) - 1): for _ in range(len(pyportal.root_group) - 1):
pyportal.splash.pop() pyportal.root_group.pop()
def touch_in_button(t, b): def touch_in_button(t, b):
@ -337,8 +337,8 @@ class Time_State(State):
def enter(self): def enter(self):
self.adjust_backlight_based_on_light(force=True) self.adjust_backlight_based_on_light(force=True)
for ta in self.text_areas: for ta in self.text_areas:
pyportal.splash.append(ta) pyportal.root_group.append(ta)
pyportal.splash.append(self.weather_icon) pyportal.root_group.append(self.weather_icon)
if snooze_time: if snooze_time:
# CircuitPython 6 & 7 compatible # CircuitPython 6 & 7 compatible
if self.snooze_file: if self.snooze_file:
@ -348,7 +348,7 @@ class Time_State(State):
icon_sprite = displayio.TileGrid(icon, pixel_shader=icon.pixel_shader) icon_sprite = displayio.TileGrid(icon, pixel_shader=icon.pixel_shader)
self.snooze_icon.append(icon_sprite) self.snooze_icon.append(icon_sprite)
pyportal.splash.append(self.snooze_icon) pyportal.root_group.append(self.snooze_icon)
if alarm_enabled: if alarm_enabled:
self.text_areas[1].text = '%2d:%02d' % (alarm_hour, alarm_minute) self.text_areas[1].text = '%2d:%02d' % (alarm_hour, alarm_minute)
else: else:
@ -532,7 +532,7 @@ class Setting_State(State):
pyportal.set_background(self.background) pyportal.set_background(self.background)
for ta in self.text_areas: for ta in self.text_areas:
pyportal.splash.append(ta) pyportal.root_group.append(ta)
if alarm_enabled: if alarm_enabled:
self.text_areas[0].text = '%02d:%02d' % (alarm_hour, alarm_minute) # set time textarea self.text_areas[0].text = '%02d:%02d' % (alarm_hour, alarm_minute) # set time textarea
else: else:

View file

@ -54,6 +54,6 @@ while True:
names_textarea.x = names_position[0] names_textarea.x = names_position[0]
names_textarea.y = names_position[1] names_textarea.y = names_position[1]
names_textarea.color = names_color names_textarea.color = names_color
pyportal.splash.append(names_textarea) pyportal.root_group.append(names_textarea)
time.sleep(30) # wait 30 seconds to read it time.sleep(30) # wait 30 seconds to read it
pyportal.splash.pop() pyportal.root_group.pop()

View file

@ -53,7 +53,7 @@ pyportal = PyPortal(default_bg=BACKGROUND_FILE,
text_color=0xFFFFFF) text_color=0xFFFFFF)
circle = Circle(WIDTH - 8, HEIGHT - 7, 5, fill=0) circle = Circle(WIDTH - 8, HEIGHT - 7, 5, fill=0)
pyportal.splash.append(circle) pyportal.root_group.append(circle)
loopcount = 0 loopcount = 0
errorcount = 0 errorcount = 0
while True: while True:

View file

@ -47,7 +47,7 @@ for pos in (days_position, hours_position, minutes_position):
textarea.x = pos[0] textarea.x = pos[0]
textarea.y = pos[1] textarea.y = pos[1]
textarea.color = text_color textarea.color = text_color
pyportal.splash.append(textarea) pyportal.root_group.append(textarea)
text_areas.append(textarea) text_areas.append(textarea)
refresh_time = None refresh_time = None

View file

@ -38,7 +38,7 @@ pyportal = PyPortal(url=DATA_SOURCE,
default_bg=0x000000) default_bg=0x000000)
gfx = electioncal_graphics.Electioncal_Graphics(pyportal.splash, am_pm=True) gfx = electioncal_graphics.Electioncal_Graphics(pyportal.root_group, am_pm=True)
display_refresh = None display_refresh = None
while True: while True:
# only query the online time once per hour (and on first run) # only query the online time once per hour (and on first run)

View file

@ -47,7 +47,7 @@ for pos in (days_position, hours_position, minutes_position):
textarea.x = pos[0] textarea.x = pos[0]
textarea.y = pos[1] textarea.y = pos[1]
textarea.color = text_color textarea.color = text_color
pyportal.splash.append(textarea) pyportal.root_group.append(textarea)
text_areas.append(textarea) text_areas.append(textarea)
refresh_time = None refresh_time = None

View file

@ -47,7 +47,7 @@ for pos in (years_position, days_position, hours_position, minutes_position):
textarea.x = pos[0] textarea.x = pos[0]
textarea.y = pos[1] textarea.y = pos[1]
textarea.color = text_color textarea.color = text_color
pyportal.splash.append(textarea) pyportal.root_group.append(textarea)
text_areas.append(textarea) text_areas.append(textarea)
refresh_time = None refresh_time = None

View file

@ -26,16 +26,16 @@ font_large.load_glyphs(glyphs)
label_overview_text = Label( label_overview_text = Label(
font_large, x=0, y=45, text="To authorize this device with Google:" font_large, x=0, y=45, text="To authorize this device with Google:"
) )
graphics.splash.append(label_overview_text) graphics.root_group.append(label_overview_text)
label_verification_url = Label(font_small, x=0, y=100, line_spacing=1) label_verification_url = Label(font_small, x=0, y=100, line_spacing=1)
graphics.splash.append(label_verification_url) graphics.root_group.append(label_verification_url)
label_user_code = Label(font_small, x=0, y=150) label_user_code = Label(font_small, x=0, y=150)
graphics.splash.append(label_user_code) graphics.root_group.append(label_user_code)
label_qr_code = Label(font_small, x=0, y=190, text="Or scan the QR code:") label_qr_code = Label(font_small, x=0, y=190, text="Or scan the QR code:")
graphics.splash.append(label_qr_code) graphics.root_group.append(label_qr_code)
# Set scope(s) of access required by the API you're using # Set scope(s) of access required by the API you're using
scopes = ["https://www.googleapis.com/auth/calendar.readonly"] scopes = ["https://www.googleapis.com/auth/calendar.readonly"]
@ -71,7 +71,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.root_group = graphics.splash graphics.display.root_group = graphics.root_group
# Poll Google's authorization server # Poll Google's authorization server
print("Waiting for browser authorization...") print("Waiting for browser authorization...")
@ -85,9 +85,9 @@ print("Add the following lines to your settings.toml file:")
print(f'GOOGLE_ACCESS_TOKEN = "{google_auth.access_token}"') print(f'GOOGLE_ACCESS_TOKEN = "{google_auth.access_token}"')
print(f'GOOGLE_REFRESH_TOKEN = "{google_auth.refresh_token}"') print(f'GOOGLE_REFRESH_TOKEN = "{google_auth.refresh_token}"')
# Remove QR code and code/verification labels # Remove QR code and code/verification labels
graphics.splash.pop() graphics.root_group.pop()
graphics.splash.pop() graphics.root_group.pop()
graphics.splash.pop() graphics.root_group.pop()
label_overview_text.text = "Successfully Authenticated!" label_overview_text.text = "Successfully Authenticated!"
label_verification_url.text = ( label_verification_url.text = (

View file

@ -202,7 +202,7 @@ font_events = "fonts/Arial-14.pcf"
# Add the header # Add the header
line_header = Line(0, 50, 320, 50, color=0x000000) line_header = Line(0, 50, 320, 50, color=0x000000)
pyportal.splash.append(line_header) pyportal.root_group.append(line_header)
label_header = pyportal.add_text( label_header = pyportal.add_text(
text_font="fonts/Arial-18.pcf", text_font="fonts/Arial-18.pcf",

View file

@ -33,7 +33,7 @@ for peg in pegs:
style=Button.RECT, style=Button.RECT,
fill_color=None, outline_color=0x5C3C15, fill_color=None, outline_color=0x5C3C15,
name=peg['label']) name=peg['label'])
pyportal.splash.append(button.group) pyportal.root_group.append(button.group)
buttons.append(button) buttons.append(button)
note_select = None note_select = None

View file

@ -86,7 +86,7 @@ countdown_text = Label(big_font)
countdown_text.x = 25 countdown_text.x = 25
countdown_text.y = 120 countdown_text.y = 120
countdown_text.color = 0x7942a0 countdown_text.color = 0x7942a0
pyportal.splash.append(countdown_text) pyportal.root_group.append(countdown_text)
refresh_time = None refresh_time = None

View file

@ -41,7 +41,7 @@ for i, c in enumerate(icons_pal):
if c == 0xFFFF00: if c == 0xFFFF00:
icons_pal.make_transparent(i) icons_pal.make_transparent(i)
storm_icons = displayio.Group() storm_icons = displayio.Group()
pyportal.splash.append(storm_icons) pyportal.root_group.append(storm_icons)
STORM_CLASS = ("TD", "TS", "HU") STORM_CLASS = ("TD", "TS", "HU")
# setup info label # setup info label
@ -53,7 +53,7 @@ info_update = Label(
) )
info_update.anchor_point = (0.0, 1.0) info_update.anchor_point = (0.0, 1.0)
info_update.anchored_position = (10, board.DISPLAY.height - 10) info_update.anchored_position = (10, board.DISPLAY.height - 10)
pyportal.splash.append(info_update) pyportal.root_group.append(info_update)
# these are need for lat/lon to screen x/y mapping # these are need for lat/lon to screen x/y mapping
VIRTUAL_WIDTH = board.DISPLAY.width * 360 / (LON_RANGE[1] - LON_RANGE[0]) VIRTUAL_WIDTH = board.DISPLAY.width * 360 / (LON_RANGE[1] - LON_RANGE[0])

View file

@ -43,21 +43,21 @@ pyportal.get_local_time()
# Date and time label # Date and time label
date_label = Label(FONT, text="0000-00-00", color=DATE_COLOR, x=165, y=223) date_label = Label(FONT, text="0000-00-00", color=DATE_COLOR, x=165, y=223)
time_label = Label(FONT, text="00:00:00", color=TIME_COLOR, x=240, y=223) time_label = Label(FONT, text="00:00:00", color=TIME_COLOR, x=240, y=223)
pyportal.splash.append(date_label) pyportal.root_group.append(date_label)
pyportal.splash.append(time_label) pyportal.root_group.append(time_label)
# ISS trail # ISS trail
trail_bitmap = displayio.Bitmap(3, 3, 1) trail_bitmap = displayio.Bitmap(3, 3, 1)
trail_palette = displayio.Palette(1) trail_palette = displayio.Palette(1)
trail_palette[0] = TRAIL_COLOR trail_palette[0] = TRAIL_COLOR
trail = displayio.Group() trail = displayio.Group()
pyportal.splash.append(trail) pyportal.root_group.append(trail)
# ISS location marker # ISS location marker
marker = displayio.Group() marker = displayio.Group()
for r in range(MARK_SIZE - MARK_THICKNESS, MARK_SIZE): for r in range(MARK_SIZE - MARK_THICKNESS, MARK_SIZE):
marker.append(Circle(0, 0, r, outline=MARK_COLOR)) marker.append(Circle(0, 0, r, outline=MARK_COLOR))
pyportal.splash.append(marker) pyportal.root_group.append(marker)
def get_location(width=WIDTH, height=HEIGHT): def get_location(width=WIDTH, height=HEIGHT):
"""Fetch current lat/lon, convert to (x, y) tuple scaled to width/height.""" """Fetch current lat/lon, convert to (x, y) tuple scaled to width/height."""

View file

@ -47,7 +47,7 @@ display = board.DISPLAY
display.rotation = 270 display.rotation = 270
# instantiate the openweather_graphics class # instantiate the openweather_graphics class
gfx = openweather_graphics.OpenWeather_Graphics(pyportal.splash, am_pm=True, celsius=False) gfx = openweather_graphics.OpenWeather_Graphics(pyportal.root_group, am_pm=True, celsius=False)
# time keeping for refreshing screen icons and weather information # time keeping for refreshing screen icons and weather information
localtile_refresh = None localtile_refresh = None

View file

@ -45,7 +45,7 @@ time_textarea = Label(big_font)
time_textarea.x = 0 time_textarea.x = 0
time_textarea.y = 130 time_textarea.y = 130
time_textarea.color = 0xFF0000 time_textarea.color = 0xFF0000
pyportal.splash.append(time_textarea) pyportal.root_group.append(time_textarea)
# To help us know if we've changed the times, print them out! # To help us know if we've changed the times, print them out!
gremlin_hour, gremlin_min = gremlin_time[3:5] gremlin_hour, gremlin_min = gremlin_time[3:5]

View file

@ -63,7 +63,7 @@ for spot in spots:
style=Button.SHADOWROUNDRECT, style=Button.SHADOWROUNDRECT,
fill_color=spot['color'], outline_color=0x222222, fill_color=spot['color'], outline_color=0x222222,
name=spot['label']) name=spot['label'])
pyportal.splash.append(button) pyportal.root_group.append(button)
buttons.append(button) buttons.append(button)
mode = 0 mode = 0

View file

@ -47,7 +47,7 @@ pyportal = PyPortal(url=DATA_SOURCE,
status_neopixel=board.NEOPIXEL, status_neopixel=board.NEOPIXEL,
default_bg=0x000000) default_bg=0x000000)
gfx = openweather_graphics.OpenWeather_Graphics(pyportal.splash, am_pm=True, celsius=False) gfx = openweather_graphics.OpenWeather_Graphics(pyportal.root_group, am_pm=True, celsius=False)
localtile_refresh = None localtile_refresh = None
weather_refresh = None weather_refresh = None

View file

@ -68,13 +68,13 @@ font_small.load_glyphs(b'abcdefghjiklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ123
label_day = label.Label(font_large, color=LABEL_DAY_COLOR) label_day = label.Label(font_large, color=LABEL_DAY_COLOR)
label_day.x = board.DISPLAY.width // 7 label_day.x = board.DISPLAY.width // 7
label_day.y = 80 label_day.y = 80
pyportal.splash.append(label_day) pyportal.root_group.append(label_day)
# Set up label for the time # Set up label for the time
label_time = label.Label(font_small, color=LABEL_TIME_COLOR) label_time = label.Label(font_small, color=LABEL_TIME_COLOR)
label_time.x = board.DISPLAY.width // 4 label_time.x = board.DISPLAY.width // 4
label_time.y = 150 label_time.y = 150
pyportal.splash.append(label_time) pyportal.root_group.append(label_time)
refresh_time = None refresh_time = None
while True: while True:

View file

@ -109,13 +109,13 @@ font_small.load_glyphs(b'abcdefghjiklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ123
label_month = label.Label(font_large, color=LABEL_DAY_COLOR) label_month = label.Label(font_large, color=LABEL_DAY_COLOR)
label_month.x = board.DISPLAY.width // 10 label_month.x = board.DISPLAY.width // 10
label_month.y = 80 label_month.y = 80
pyportal.splash.append(label_month) pyportal.root_group.append(label_month)
# Set up label for the time # Set up label for the time
label_time = label.Label(font_small, color=LABEL_TIME_COLOR) label_time = label.Label(font_small, color=LABEL_TIME_COLOR)
label_time.x = board.DISPLAY.width // 3 label_time.x = board.DISPLAY.width // 3
label_time.y = 150 label_time.y = 150
pyportal.splash.append(label_time) pyportal.root_group.append(label_time)
refresh_time = None refresh_time = None
while True: while True:

View file

@ -104,11 +104,11 @@ class Switch(object):
self.switch.direction = digitalio.Direction.OUTPUT self.switch.direction = digitalio.Direction.OUTPUT
rect = RoundRect(SWITCHX, SWITCHY, 31, 60, 16, outline=SWITCH_COLOR, rect = RoundRect(SWITCHX, SWITCHY, 31, 60, 16, outline=SWITCH_COLOR,
fill=SWITCH_FILL_COLOR, stroke=3) fill=SWITCH_FILL_COLOR, stroke=3)
my_pyportal.splash.append(rect) my_pyportal.root_group.append(rect)
self.circle_on = Circle(SWITCHX + 15, SWITCHY + 16, 10, fill=SWITCH_FILL_COLOR) self.circle_on = Circle(SWITCHX + 15, SWITCHY + 16, 10, fill=SWITCH_FILL_COLOR)
my_pyportal.splash.append(self.circle_on) my_pyportal.root_group.append(self.circle_on)
self.circle_off = Circle(SWITCHX + 15, SWITCHY + 42, 10, fill=DISPLAY_COLOR) self.circle_off = Circle(SWITCHX + 15, SWITCHY + 42, 10, fill=DISPLAY_COLOR)
my_pyportal.splash.append(self.circle_off) my_pyportal.root_group.append(self.circle_off)
# turn switch on or off # turn switch on or off
def enable(self, enable): def enable(self, enable):
@ -149,7 +149,7 @@ class Clock(object):
self.text_areas = create_text_areas(text_area_configs) self.text_areas = create_text_areas(text_area_configs)
self.text_areas[2].text = "starting..." self.text_areas[2].text = "starting..."
for ta in self.text_areas: for ta in self.text_areas:
self.pyportal.splash.append(ta) self.pyportal.root_group.append(ta)
def adjust_backlight(self, force=False): def adjust_backlight(self, force=False):
"""Check light level. Adjust the backlight and background image if it's dark.""" """Check light level. Adjust the backlight and background image if it's dark."""

View file

@ -61,7 +61,7 @@ DATE_LABEL = Label(date_font, text="0000-00-00 00:00:00", color=DATE_COLOR, x=75
# Add all the labels to the display # Add all the labels to the display
for label in HI_LABELS + LO_LABELS + [DATE_LABEL]: for label in HI_LABELS + LO_LABELS + [DATE_LABEL]:
pyportal.splash.append(label) pyportal.root_group.append(label)
def get_tide_info(): def get_tide_info():
"""Fetch JSON tide time info and return it.""" """Fetch JSON tide time info and return it."""

View file

@ -67,7 +67,7 @@ palette.make_transparent(0)
# Setup tide plot bitmap # Setup tide plot bitmap
tide_plot = displayio.Bitmap(WIDTH, HEIGHT, 3) tide_plot = displayio.Bitmap(WIDTH, HEIGHT, 3)
pyportal.splash.append(displayio.TileGrid(tide_plot, pixel_shader=palette)) pyportal.root_group.append(displayio.TileGrid(tide_plot, pixel_shader=palette))
# Setup font used for date and time # Setup font used for date and time
date_font = bitmap_font.load_font(cwd+"/fonts/mono-bold-8.bdf") date_font = bitmap_font.load_font(cwd+"/fonts/mono-bold-8.bdf")
@ -75,7 +75,7 @@ date_font.load_glyphs(b'1234567890-')
# Setup date label # Setup date label
date_label = Label(date_font, text="0000-00-00", color=DATE_COLOR, x=7, y=14) date_label = Label(date_font, text="0000-00-00", color=DATE_COLOR, x=7, y=14)
pyportal.splash.append(date_label) pyportal.root_group.append(date_label)
if board.board_id == "pyportal_titano": if board.board_id == "pyportal_titano":
x_pos = 394 x_pos = 394
@ -84,14 +84,14 @@ else:
# Setup time label # Setup time label
time_label = Label(date_font, text="00:00:00", color=TIME_COLOR, x=x_pos, y=14) time_label = Label(date_font, text="00:00:00", color=TIME_COLOR, x=x_pos, y=14)
pyportal.splash.append(time_label) pyportal.root_group.append(time_label)
# Setup current time marker # Setup current time marker
time_marker_bitmap = displayio.Bitmap(MARK_SIZE, MARK_SIZE, 3) time_marker_bitmap = displayio.Bitmap(MARK_SIZE, MARK_SIZE, 3)
for pixel in range(MARK_SIZE * MARK_SIZE): for pixel in range(MARK_SIZE * MARK_SIZE):
time_marker_bitmap[pixel] = 2 time_marker_bitmap[pixel] = 2
time_marker = displayio.TileGrid(time_marker_bitmap, pixel_shader=palette, x=-MARK_SIZE, y=-MARK_SIZE) time_marker = displayio.TileGrid(time_marker_bitmap, pixel_shader=palette, x=-MARK_SIZE, y=-MARK_SIZE)
pyportal.splash.append(time_marker) pyportal.root_group.append(time_marker)
def get_tide_data(): def get_tide_data():
"""Fetch JSON tide data and return parsed results in a list.""" """Fetch JSON tide data and return parsed results in a list."""

View file

@ -51,7 +51,7 @@ DATE_LABEL = Label(date_font, text="0000-00-00 00:00:00", color=DATE_COLOR, x=75
# Add all the labels to the display # Add all the labels to the display
for label in HI_LABELS + LO_LABELS + [DATE_LABEL]: for label in HI_LABELS + LO_LABELS + [DATE_LABEL]:
pyportal.graphics.splash.append(label) pyportal.graphics.root_group.append(label)
def get_tide_info(): def get_tide_info():

View file

@ -47,7 +47,7 @@ palette.make_transparent(0)
# Setup tide plot bitmap # Setup tide plot bitmap
tide_plot = displayio.Bitmap(WIDTH, HEIGHT, 3) tide_plot = displayio.Bitmap(WIDTH, HEIGHT, 3)
pyportal.graphics.splash.append(displayio.TileGrid(tide_plot, pixel_shader=palette)) pyportal.graphics.root_group.append(displayio.TileGrid(tide_plot, pixel_shader=palette))
# Setup font used for date and time # Setup font used for date and time
date_font = bitmap_font.load_font("/fonts/mono-bold-8.bdf") date_font = bitmap_font.load_font("/fonts/mono-bold-8.bdf")
@ -55,11 +55,11 @@ date_font.load_glyphs(b"1234567890-")
# Setup date label # Setup date label
date_label = Label(date_font, text="0000-00-00", color=DATE_COLOR, x=7, y=14) date_label = Label(date_font, text="0000-00-00", color=DATE_COLOR, x=7, y=14)
pyportal.graphics.splash.append(date_label) pyportal.graphics.root_group.append(date_label)
# Setup time label # Setup time label
time_label = Label(date_font, text="00:00:00", color=TIME_COLOR, x=234, y=14) time_label = Label(date_font, text="00:00:00", color=TIME_COLOR, x=234, y=14)
pyportal.graphics.splash.append(time_label) pyportal.graphics.root_group.append(time_label)
# Setup current time marker # Setup current time marker
time_marker_bitmap = displayio.Bitmap(MARK_SIZE, MARK_SIZE, 3) time_marker_bitmap = displayio.Bitmap(MARK_SIZE, MARK_SIZE, 3)
@ -67,7 +67,7 @@ time_marker_bitmap.fill(2)
time_marker = displayio.TileGrid( time_marker = displayio.TileGrid(
time_marker_bitmap, pixel_shader=palette, x=-MARK_SIZE, y=-MARK_SIZE time_marker_bitmap, pixel_shader=palette, x=-MARK_SIZE, y=-MARK_SIZE
) )
pyportal.graphics.splash.append(time_marker) pyportal.graphics.root_group.append(time_marker)
def get_tide_data(): def get_tide_data():

View file

@ -133,7 +133,7 @@ alarm_checks = [None, alarms['bed'],alarms['breakfast'],alarms['lunch'],alarms['
alarm_gfx = [group_trash, group_bed, group_eat, group_eat, group_eat] alarm_gfx = [group_trash, group_bed, group_eat, group_eat, group_eat]
# allows for the openweather_graphics to show # allows for the openweather_graphics to show
gfx = openweather_graphics.OpenWeather_Graphics(pyportal.splash, am_pm=True, celsius=False) gfx = openweather_graphics.OpenWeather_Graphics(pyportal.root_group, am_pm=True, celsius=False)
# state machines # state machines
localtile_refresh = None localtile_refresh = None
@ -250,13 +250,13 @@ while True:
print("pressed dismiss button") print("pressed dismiss button")
dismissed = True dismissed = True
alarm = False alarm = False
display.root_group = pyportal.splash display.root_group = pyportal.root_group
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.root_group = pyportal.splash display.root_group = pyportal.root_group
snoozed = True snoozed = True
alarm = False alarm = False
touched = time.monotonic() touched = time.monotonic()
@ -271,7 +271,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.root_group = pyportal.splash display.root_group = pyportal.root_group
touch_button_snooze = True touch_button_snooze = True
snoozed = True snoozed = True
alarm = False alarm = False
@ -281,7 +281,7 @@ while True:
print("Touched dismiss") print("Touched dismiss")
dismissed = True dismissed = True
alarm = False alarm = False
display.root_group = pyportal.splash display.root_group = pyportal.root_group
touch_button_dismiss = True touch_button_dismiss = True
touched = time.monotonic() touched = time.monotonic()
mode = mode mode = mode

View file

@ -121,12 +121,12 @@ pyportal = PyPortal(url=DATA_SOURCE,
pyportal.preload_font() # speed things up by preloading font pyportal.preload_font() # speed things up by preloading font
pyportal.splash.append(loading_text_area) #loading... pyportal.root_group.append(loading_text_area) #loading...
pyportal.splash.append(q_text_area) pyportal.root_group.append(q_text_area)
pyportal.splash.append(reveal_text_area) pyportal.root_group.append(reveal_text_area)
pyportal.splash.append(timer_text_area) pyportal.root_group.append(timer_text_area)
for textarea in ans_text_areas: for textarea in ans_text_areas:
pyportal.splash.append(textarea) pyportal.root_group.append(textarea)
while True: while True:
# Load new question when screen is touched # Load new question when screen is touched

View file

@ -80,7 +80,7 @@ pyportal = PyPortal(url=url,
caption_font=CAPTION_FONT_FILE) caption_font=CAPTION_FONT_FILE)
canvas = displayio.Group() canvas = displayio.Group()
pyportal.splash.append(canvas) pyportal.root_group.append(canvas)
bar_font = bitmap_font.load_font(BAR_FONT_FILE) bar_font = bitmap_font.load_font(BAR_FONT_FILE)
while True: while True:

View file

@ -84,9 +84,9 @@ light_on_time_position = (15,220)
light_on_time_textarea = Label(info_font, color=light_on_time_color, light_on_time_textarea = Label(info_font, color=light_on_time_color,
x=light_on_time_position[0], y=light_on_time_position[1]) x=light_on_time_position[0], y=light_on_time_position[1])
pyportal.splash.append(time_textarea) pyportal.root_group.append(time_textarea)
pyportal.splash.append(wakeup_time_textarea) pyportal.root_group.append(wakeup_time_textarea)
pyportal.splash.append(light_on_time_textarea) pyportal.root_group.append(light_on_time_textarea)
while True: while True:
try: try:

View file

@ -48,7 +48,7 @@ for pos in (days_position, hours_position, minutes_position):
textarea.x = pos[0] textarea.x = pos[0]
textarea.y = pos[1] textarea.y = pos[1]
textarea.color = text_color textarea.color = text_color
pyportal.splash.append(textarea) pyportal.root_group.append(textarea)
text_areas.append(textarea) text_areas.append(textarea)
refresh_time = None refresh_time = None