v0.62.0: andTunes 0.4.0 — speakers (AirPlay, Chromecast), a list for a menu, icon pills, full-screen art

Now Playing: tap the art for it full screen, the title or artist line
for its album; shuffle, repeat and a new speakers button are icon pills.
The main menu is a list (Now Playing on top, Settings at the bottom, six
rows to a screen). The speakers button lists this Rabbit plus every
AirPlay speaker and Chromecast on the Wi-Fi: AirPlayRemote is the
desktop's RAOP sender in Java (verified from the R1 against
shairport-sync), CastRemote speaks the Cast protocol directly to the
Default Media Receiver and serves the file over HTTP (not yet tried on a
real Chromecast).
This commit is contained in:
2026-10-17 01:00:54 -07:00
parent 770a239138
commit 7ad51ab4dc
28 changed files with 2351 additions and 86 deletions
+77 -1
View File
@@ -42,6 +42,9 @@ MENU = {
}
ICON = 128
TRANSPORT = ("prev", "play", "pause", "next")
# Now Playing's bottom row: icons inside the toggle pills (drawn black; the
# app tints them white when the pill is on).
TOGGLES = ("shuffle", "repeat", "repeat_one", "speakers")
def _canvas(w, h):
@@ -97,6 +100,77 @@ def transport(name: str, color="black", size=ICON) -> QImage:
return image
def toggle_icon(name: str, color="black", size=ICON) -> QImage:
from PyQt6.QtGui import QPen
image, p = _canvas(size, size)
s = size / 128
pen = QPen(QColor(color), 10 * s)
pen.setCapStyle(Qt.PenCapStyle.FlatCap)
pen.setJoinStyle(Qt.PenJoinStyle.MiterJoin)
p.setPen(pen)
p.setBrush(Qt.BrushStyle.NoBrush)
def head(x, y, right=True):
# a solid arrowhead whose point is at (x, y)
d = 1 if right else -1
p.save()
p.setPen(Qt.PenStyle.NoPen)
p.setBrush(QColor(color))
p.drawPolygon(QPolygonF([QPointF(x, y), QPointF(x - d * 22 * s, y - 16 * s),
QPointF(x - d * 22 * s, y + 16 * s)]))
p.restore()
if name == "shuffle":
# two strands that cross, each ending in an arrow on the right
a = QPainterPath(QPointF(14 * s, 38 * s))
a.cubicTo(QPointF(60 * s, 38 * s), QPointF(60 * s, 90 * s),
QPointF(96 * s, 90 * s))
b = QPainterPath(QPointF(14 * s, 90 * s))
b.cubicTo(QPointF(60 * s, 90 * s), QPointF(60 * s, 38 * s),
QPointF(96 * s, 38 * s))
p.drawPath(a)
p.drawPath(b)
head(116 * s, 38 * s)
head(116 * s, 90 * s)
elif name in ("repeat", "repeat_one"):
# a loop: top run left to right, bottom run back, rounded ends
loop = QPainterPath(QPointF(30 * s, 64 * s))
loop.lineTo(30 * s, 52 * s)
loop.arcTo(QRectF(30 * s, 32 * s, 40 * s, 40 * s), 180, -90)
loop.lineTo(92 * s, 32 * s)
p.drawPath(loop)
head(114 * s, 32 * s)
back = QPainterPath(QPointF(98 * s, 64 * s))
back.lineTo(98 * s, 76 * s)
back.arcTo(QRectF(58 * s, 56 * s, 40 * s, 40 * s), 0, -90)
back.lineTo(36 * s, 96 * s)
p.drawPath(back)
head(14 * s, 96 * s, right=False)
if name == "repeat_one":
font = QFont("DejaVu Sans")
font.setPixelSize(int(34 * s))
font.setBold(True)
p.setFont(font)
p.setPen(QColor(color))
p.drawText(QRectF(44 * s, 40 * s, 40 * s, 48 * s),
int(Qt.AlignmentFlag.AlignCenter), "1")
elif name == "speakers":
# broadcast: a dot with two arcs either side, (( • ))
p.save()
p.setPen(Qt.PenStyle.NoPen)
p.setBrush(QColor(color))
p.drawEllipse(QPointF(64 * s, 64 * s), 11 * s, 11 * s)
p.restore()
pen.setCapStyle(Qt.PenCapStyle.RoundCap)
p.setPen(pen)
for r in (30, 52):
box = QRectF((64 - r) * s, (64 - r) * s, 2 * r * s, 2 * r * s)
p.drawArc(box, -45 * 16, 90 * 16)
p.drawArc(box, 135 * 16, 90 * 16)
p.end()
return image
def launcher() -> QImage:
size = 192
image, p = _canvas(size, size)
@@ -125,10 +199,12 @@ def main():
save(tile(label), name, RES, SHIP)
for name in TRANSPORT:
save(transport(name), name, RES, SHIP)
for name in TOGGLES:
save(toggle_icon(name), name, RES, SHIP)
save(launcher(), "ic_launcher", RES)
# Status-bar icons must be white-on-transparent; Android tints by alpha.
save(transport("play", "white", 96), "ic_notify", RES)
print(f"wrote {len(MENU) + len(TRANSPORT)} buttons to {RES} and {SHIP}")
print(f"wrote {len(MENU) + len(TRANSPORT) + len(TOGGLES)} buttons to {RES} and {SHIP}")
if __name__ == "__main__":