Always render the show/host and time rows, even when empty
Previously these rows were only added when the underlying data was present, so the layout would shift depending on what SUB/WAVE happened to report at the moment -- e.g. the time row would jump up a line whenever there was no active show. Now both rows always render (with blank text where needed) so they hold a fixed vertical position regardless of what data is available.
This commit is contained in:
1 parent
4a01de30de
commit
fb048df885
1 file changed
+11
-8
+11
-8
@@ -121,18 +121,21 @@ def main(config):
|
|||||||
art = _fetch_cover(station_url, now["subsonic_id"])
|
art = _fetch_cover(station_url, now["subsonic_id"])
|
||||||
progress = _track_progress(now["subsonic_id"], now["duration"])
|
progress = _track_progress(now["subsonic_id"], now["duration"])
|
||||||
|
|
||||||
|
# The show/host and time/temp rows always render, even when empty, so
|
||||||
|
# they hold a fixed vertical position regardless of which fields a given
|
||||||
|
# track/moment actually has data for -- rather than the layout shifting
|
||||||
|
# up when e.g. there's a show but no DJ credited, or no show at all.
|
||||||
|
show_host_row = [render.Text(now["show"], font = "tom-thumb", color = colors["text"])]
|
||||||
|
if now["host"]:
|
||||||
|
show_host_row.append(render.Text(" " + now["host"], font = "tom-thumb", color = colors["accent"]))
|
||||||
|
|
||||||
top_lines = [
|
top_lines = [
|
||||||
render.Marquee(width = 32, child = render.Text(now["title"], color = colors["text"])),
|
render.Marquee(width = 32, child = render.Text(now["title"], color = colors["text"])),
|
||||||
render.Marquee(width = 32, child = render.Text(now["artist"], color = colors["text"])),
|
render.Marquee(width = 32, child = render.Text(now["artist"], color = colors["text"])),
|
||||||
|
render.Box(width = 32, height = 1, color = colors["separator"]),
|
||||||
|
render.Marquee(width = 32, child = render.Row(children = show_host_row)),
|
||||||
|
render.Marquee(width = 32, child = render.Text(now["time_temp"], font = "tom-thumb", color = colors["meta"])),
|
||||||
]
|
]
|
||||||
if now["show"]:
|
|
||||||
top_lines.append(render.Box(width = 32, height = 1, color = colors["separator"]))
|
|
||||||
show_host_row = [render.Text(now["show"], font = "tom-thumb", color = colors["text"])]
|
|
||||||
if now["host"]:
|
|
||||||
show_host_row.append(render.Text(" " + now["host"], font = "tom-thumb", color = colors["accent"]))
|
|
||||||
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 = colors["meta"])))
|
|
||||||
|
|
||||||
children = [render.Column(children = top_lines)]
|
children = [render.Column(children = top_lines)]
|
||||||
if progress != None:
|
if progress != None:
|
||||||
|
|||||||