Revert to native Marquee for all lines; remove album-art overlap
This commit is contained in:
1 parent
f864d43888
commit
74be033a29
2 files changed
+48
-71
No files matched your search
+21
-51
@@ -20,7 +20,7 @@ COLOR_ARTIST = "#22d3ee" # cyan
|
||||
COLOR_SEPARATOR = "#444444" # thin divider between artist and show/host
|
||||
COLOR_SHOW = "#e0e0e0" # near-white
|
||||
COLOR_HOST = "#ec4899" # magenta/pink
|
||||
COLOR_META = "#888888" # muted gray, for the time/temp footer
|
||||
COLOR_META = "#888888" # muted gray, for the time/temp line
|
||||
COLOR_BAR_FILLED = "#c026d3" # magenta/purple
|
||||
COLOR_BAR_EMPTY = "#333333"
|
||||
|
||||
@@ -46,27 +46,34 @@ def main(config):
|
||||
render.Marquee(width = 32, child = render.Text(now["title"], color = COLOR_TITLE)),
|
||||
render.Marquee(width = 32, child = render.Text(now["artist"], color = COLOR_ARTIST)),
|
||||
]
|
||||
# Note: show/host is plain Text/Row, not Marquee. Pixlet's Marquee runs
|
||||
# its own internal scroll-cycle animation regardless of whether the text
|
||||
# actually needs to scroll, and combining multiple Marquees with very
|
||||
# different cycle lengths in one Root desyncs them -- confirmed via an
|
||||
# isolated repro where a short Marquee'd line intermittently collapsed to
|
||||
# a single character on frames where the long title/artist marquees were
|
||||
# mid-cycle. Plain Text just clips if too wide, an acceptable tradeoff
|
||||
# for this short field.
|
||||
if now["show"]:
|
||||
top_lines.append(render.Box(width = 32, height = 1, color = COLOR_SEPARATOR))
|
||||
show_host_row = [render.Text(now["show"], font = "tom-thumb", color = COLOR_SHOW)]
|
||||
if now["host"]:
|
||||
show_host_row.append(render.Text(" " + now["host"], font = "tom-thumb", color = COLOR_HOST))
|
||||
top_lines.append(render.Row(children = show_host_row))
|
||||
top_lines.append(render.Marquee(width = 32, child = render.Row(children = show_host_row)))
|
||||
if now["time_temp"]:
|
||||
top_lines.append(render.Marquee(width = 32, child = render.Text(now["time_temp"], font = "tom-thumb", color = COLOR_META)))
|
||||
|
||||
text_column = render.Column(children = top_lines)
|
||||
children = [render.Column(children = top_lines)]
|
||||
if progress != None:
|
||||
children.append(_progress_bar(progress["fraction"], width = 32))
|
||||
|
||||
text_column = render.Box(
|
||||
width = 32,
|
||||
height = 32,
|
||||
child = render.Column(
|
||||
main_align = "space_between",
|
||||
cross_align = "start",
|
||||
expanded = True,
|
||||
children = children,
|
||||
),
|
||||
)
|
||||
|
||||
if art:
|
||||
base = render.Row(children = [render.Image(src = art, width = 32, height = 32), text_column])
|
||||
content = render.Row(children = [render.Image(src = art, width = 32, height = 32), text_column])
|
||||
else:
|
||||
base = render.Column(
|
||||
content = render.Column(
|
||||
main_align = "center",
|
||||
cross_align = "center",
|
||||
expanded = True,
|
||||
@@ -76,44 +83,7 @@ def main(config):
|
||||
],
|
||||
)
|
||||
|
||||
# Time/temp and the progress bar are rendered as a full-width (64px)
|
||||
# footer overlaid on top of the base layout via Stack, rather than
|
||||
# squeezed into the 32px-wide text column -- gives roughly 2x the
|
||||
# character budget for the time/temp line, at the cost of covering the
|
||||
# bottom ~9px of the album art with a translucent bar.
|
||||
footer_children = []
|
||||
if now["time_temp"]:
|
||||
footer_children.append(
|
||||
render.Box(
|
||||
width = 64,
|
||||
height = 7,
|
||||
color = "#000000cc",
|
||||
child = render.Row(
|
||||
expanded = True,
|
||||
main_align = "center",
|
||||
cross_align = "center",
|
||||
children = [render.Text(now["time_temp"], font = "tom-thumb", color = COLOR_META)],
|
||||
),
|
||||
),
|
||||
)
|
||||
if progress != None:
|
||||
footer_children.append(_progress_bar(progress["fraction"], width = 64))
|
||||
|
||||
if not footer_children:
|
||||
return render.Root(child = base)
|
||||
|
||||
footer = render.Box(
|
||||
width = 64,
|
||||
height = 32,
|
||||
child = render.Column(
|
||||
main_align = "end",
|
||||
cross_align = "start",
|
||||
expanded = True,
|
||||
children = [render.Column(children = footer_children)],
|
||||
),
|
||||
)
|
||||
|
||||
return render.Root(child = render.Stack(children = [base, footer]))
|
||||
return render.Root(child = content)
|
||||
|
||||
def _message_screen(lines):
|
||||
return render.Column(
|
||||
|
||||