v0.77.1: a cassetted song shows a little blue down-arrow instead of going grey
Asked for and waiting to download now reads as that: the button stays pressed in, in its own face, with the tape nudged up-left and a blue arrow in the corner (paler for a partly asked-for artist or album, faded on hover to say a click lets it go). The guide's icons and friend-mode screenshot are repainted with the same code.
@@ -90,8 +90,8 @@ your computer yet). Instead, every artist, album and song has a little
|
||||
| Button | What it means |
|
||||
|---|---|
|
||||
| <img src="docs/cassette/cassette-off.png" width="28" alt="cassette button, not pressed"> | Not asked for. Click it to ask your friend for this. |
|
||||
| <img src="docs/cassette/cassette-on.png" width="28" alt="cassette button, pressed"> | Asked for — this song is on its way to you. Click again to change your mind. |
|
||||
| <img src="docs/cassette/cassette-partial.png" width="28" alt="cassette button, partly pressed"> | Some of this artist's or album's songs are asked for. Click to ask for all of them. |
|
||||
| <img src="docs/cassette/cassette-on.png" width="28" alt="cassette button, pressed, with a blue down-arrow"> | Asked for — the blue arrow means this song is waiting to download to you. Click again to change your mind. |
|
||||
| <img src="docs/cassette/cassette-partial.png" width="28" alt="cassette button, pressed, with a pale blue down-arrow"> | Some of this artist's or album's songs are asked for. Click to ask for all of them. |
|
||||
|
||||
Pressing the button on an **artist** or **album** asks for every song under it.
|
||||
|
||||
|
||||
|
Before Width: | Height: | Size: 2.3 KiB After Width: | Height: | Size: 3.0 KiB |
|
Before Width: | Height: | Size: 2.3 KiB After Width: | Height: | Size: 2.9 KiB |
|
Before Width: | Height: | Size: 2.3 KiB After Width: | Height: | Size: 3.0 KiB |
|
Before Width: | Height: | Size: 158 KiB After Width: | Height: | Size: 158 KiB |
@@ -1,3 +1,3 @@
|
||||
"""LinTunes — iTunes-style music library manager and player for Linux."""
|
||||
|
||||
__version__ = "0.77.0"
|
||||
__version__ = "0.77.1"
|
||||
|
||||
@@ -1,9 +1,11 @@
|
||||
"""Cassette's two little pictures, painted (no image files to ship or theme).
|
||||
|
||||
* The **cassette button**: a small embossed square with a tape glyph. Raised
|
||||
when off; pressed in and grey when on ("I want this"); a medium grey on
|
||||
hover over a pressed one, to say a click would let it go. Functionally
|
||||
it's a checkbox — the tape is reserved for asking friends for songs.
|
||||
when off; pressed in with a little blue down-arrow when on ("asked for,
|
||||
on its way"); the arrow fades on hover over a pressed one, to say a click
|
||||
would let it go. Partly asked for (an artist or album) is a paler
|
||||
arrow. Functionally it's a checkbox — the tape is reserved for asking
|
||||
friends for songs.
|
||||
* The **UFO**: a friend's playlist. Light purple when followed, a grey
|
||||
outline when not.
|
||||
|
||||
@@ -24,8 +26,7 @@ UFO_PURPLE = QColor("#b38ee8")
|
||||
|
||||
OFF, ON, PARTIAL = "off", "on", "partial"
|
||||
|
||||
ON_GREY = QColor("#9c9c9c")
|
||||
ON_HOVER_GREY = QColor("#bdbdbd")
|
||||
ASKED_BLUE = QColor("#2f7de1") # the "on its way" arrow
|
||||
|
||||
|
||||
def friend_button_qss(selector: str = "QPushButton", padding: str = "3px 12px") -> str:
|
||||
@@ -58,24 +59,56 @@ def paint_cassette_button(painter: QPainter, rect: QRectF, state: str,
|
||||
gradient.setColorAt(0, top)
|
||||
gradient.setColorAt(1, base.darker(106))
|
||||
else:
|
||||
fill = ON_HOVER_GREY if hovered else ON_GREY
|
||||
if state == PARTIAL:
|
||||
fill = QColor(fill).lighter(118)
|
||||
gradient.setColorAt(0, fill.darker(108)) # pressed in: lit from below
|
||||
gradient.setColorAt(1, fill.lighter(106))
|
||||
gradient.setColorAt(0, base.darker(118)) # pressed in: lit from below
|
||||
gradient.setColorAt(1, base.darker(104))
|
||||
painter.setBrush(QBrush(gradient))
|
||||
painter.setPen(QPen(mid, 1))
|
||||
painter.drawRoundedRect(box, radius, radius)
|
||||
|
||||
ink = QColor(palette.text().color())
|
||||
if state != OFF:
|
||||
ink = QColor("#303030")
|
||||
ink.setAlpha(200 if state != OFF else 150)
|
||||
_paint_tape(painter, box, ink, half=(state == PARTIAL))
|
||||
ink.setAlpha(150)
|
||||
if state == OFF:
|
||||
_paint_tape(painter, box, ink)
|
||||
else:
|
||||
# the tape moves up and left to make room for the arrow
|
||||
_paint_tape(painter, box.translated(-box.width() * 0.06,
|
||||
-box.height() * 0.08), ink)
|
||||
blue = QColor(ASKED_BLUE)
|
||||
blue.setAlpha((255 if state == ON else 130) // (2 if hovered else 1))
|
||||
_paint_arrow(painter, box, blue, base.darker(110))
|
||||
painter.restore()
|
||||
|
||||
|
||||
def _paint_tape(painter: QPainter, box: QRectF, ink: QColor, half=False):
|
||||
def _paint_arrow(painter: QPainter, box: QRectF, color: QColor,
|
||||
halo: QColor):
|
||||
"""A down-arrow in the bottom-right corner, ringed in the button's own
|
||||
face so it stands off the tape behind it."""
|
||||
w, h = box.width(), box.height()
|
||||
cx = box.left() + w * 0.75
|
||||
top, bottom = box.top() + h * 0.5, box.top() + h * 0.88
|
||||
shaft, head = w * 0.08, w * 0.17
|
||||
neck = bottom - h * 0.17
|
||||
path = QPainterPath()
|
||||
path.moveTo(cx - shaft, top)
|
||||
path.lineTo(cx + shaft, top)
|
||||
path.lineTo(cx + shaft, neck)
|
||||
path.lineTo(cx + head, neck)
|
||||
path.lineTo(cx, bottom)
|
||||
path.lineTo(cx - head, neck)
|
||||
path.lineTo(cx - shaft, neck)
|
||||
path.closeSubpath()
|
||||
line = max(1.0, w / 16)
|
||||
painter.setBrush(Qt.BrushStyle.NoBrush)
|
||||
painter.setPen(QPen(halo, line * 3, Qt.PenStyle.SolidLine,
|
||||
Qt.PenCapStyle.RoundCap, Qt.PenJoinStyle.RoundJoin))
|
||||
painter.drawPath(path)
|
||||
painter.setPen(QPen(color, line, Qt.PenStyle.SolidLine,
|
||||
Qt.PenCapStyle.RoundCap, Qt.PenJoinStyle.RoundJoin))
|
||||
painter.setBrush(color)
|
||||
painter.drawPath(path)
|
||||
|
||||
|
||||
def _paint_tape(painter: QPainter, box: QRectF, ink: QColor):
|
||||
"""A cassette: body, label window, two reels."""
|
||||
w, h = box.width(), box.height()
|
||||
body = QRectF(box.left() + w * 0.16, box.top() + h * 0.28,
|
||||
@@ -96,9 +129,6 @@ def _paint_tape(painter: QPainter, box: QRectF, ink: QColor, half=False):
|
||||
path.lineTo(body.left() + body.width() * 0.7, body.bottom() - body.height() * 0.22)
|
||||
path.lineTo(body.left() + body.width() * 0.78, body.bottom())
|
||||
painter.drawPath(path)
|
||||
if half:
|
||||
painter.drawLine(QPointF(body.left() + body.width() * 0.4, cy),
|
||||
QPointF(body.left() + body.width() * 0.6, cy))
|
||||
|
||||
|
||||
def paint_ufo(painter: QPainter, rect: QRectF, color: QColor,
|
||||
|
||||