v0.61.0: buttons darken clearly while held; the play box is three touching buttons; taller scrubber; crisp art border

Held is now PRESSED_DARKER 125 (between Material 3 and GNOME), sunk, on
every button. Transport boxes no longer carry the face themselves (a
QFrame has no pressed state): each button does, so shuffle, repeat and
bpm sink while held and the play box's tiles act as separate buttons with
no grey hover patch. Scrollbar thumbs darken further while dragged. The
seek bar's groove and knob are twice as tall. The album art meets a 1 px
line in the lists' grey, without the pale blend that doubled it.
This commit is contained in:
2026-10-17 00:39:46 -07:00
parent 293d253258
commit 42114f252b
8 changed files with 178 additions and 41 deletions
+28 -28
View File
@@ -41,35 +41,31 @@ TOP = Qt.AlignmentFlag.AlignTop
# (Library button · search or playlist name · seek) at the medium UI scale.
BAR_HEIGHT = TOP_MARGIN + CONTROL_HEIGHT + ROW_GAP + 34
def _box_style(bg: QColor, button: bool = False) -> str:
"""A transport box. A box that *is* one button (shuffle, bpm) gets the
shared button face — emboss, outline, whole-box darkening on hover; the
three-tile play box gets the same face, and each tile darkens on its own
(see TILE_STYLE)."""
face = theme.button_face_qss("QFrame#transportBox", bg, radius=8)
if not button:
# Hover belongs to the tiles here, not the whole box.
face += (f"QFrame#transportBox:hover {{ background:"
f" {theme.emboss_gradient(bg)}; }}")
def _box_style(bg: QColor) -> str:
"""A transport box is its buttons: each one carries the shared button
face (emboss, outline, darker on hover, sunk and darker while held), and
the box itself draws nothing. The play box's three are separate buttons
that touch — square where they meet, sharing one line (TILE_STYLE)."""
face = "QFrame#transportBox { border: none; background: transparent; }"
for kind in ("QToolButton", "QPushButton"):
face += theme.button_face_qss(f"QFrame#transportBox > {kind}", bg,
radius=8)
return face + TILE_STYLE
# Tool buttons inside a box: no light panel of their own. A tile in the play
# box darkens slightly under the cursor — the same "whole button, a little
# darker" as every other button — and a lone button leaves that to its box.
TILE_STYLE = """
QFrame#transportBox QToolButton, QFrame#transportBox QPushButton {
border: none; background: transparent; border-radius: 6px;
}
# Where tiles meet: square corners, and one shared line (the later tile
# drops its left border), as the Library button and its ▾ do.
TILE_STYLE = "".join(
f"QFrame#transportBox > {kind}[tile=\"{tile}\"] {{ {rule} }}"
for kind in ("QToolButton", "QPushButton")
for tile, rule in (
("first", "border-top-right-radius: 0; border-bottom-right-radius: 0;"),
("middle", "border-radius: 0; border-left: none;"),
("last", "border-top-left-radius: 0; border-bottom-left-radius: 0;"
" border-left: none;"))) + """
QFrame#transportBox QPushButton, QFrame#transportBox QPushButton:disabled {
color: black;
}
QFrame#transportBox[tiles="true"] QToolButton:hover {
background: rgba(0, 0, 0, 22);
}
QFrame#transportBox[tiles="true"] QToolButton:pressed {
background: rgba(0, 0, 0, 38);
}
"""
@@ -133,12 +129,15 @@ def _box(*widgets, bg: QColor, margins=(10, 3, 10, 3), hug=False,
a full-bleed tap target with its content centered in its share."""
frame = QFrame()
frame.setObjectName("transportBox")
# A box holding one control is that control: it darkens as a whole.
frame.setProperty("tiles", len(widgets) > 1)
frame.setAttribute(Qt.WidgetAttribute.WA_Hover)
frame.setStyleSheet(_box_style(bg, button=len(widgets) == 1))
if len(widgets) > 1:
for i, widget in enumerate(widgets):
widget.setProperty("tile", "first" if i == 0 else
"last" if i == len(widgets) - 1 else "middle")
frame.setStyleSheet(_box_style(bg))
inner = QHBoxLayout(frame)
inner.setContentsMargins(*margins)
# A split box is all button, edge to edge: the face is the buttons'.
inner.setContentsMargins(*((0, 0, 0, 0) if split else margins))
if split:
inner.setSpacing(0)
for widget in widgets:
@@ -492,6 +491,7 @@ class TransportBar(QWidget):
self._remaining_label.setAlignment(Qt.AlignmentFlag.AlignRight
| Qt.AlignmentFlag.AlignBottom)
self._slider = SeekSlider()
self._slider.setProperty("tall", True) # twice Fusion's height
self._slider.setRange(0, 0)
self._slider.setFocusPolicy(Qt.FocusPolicy.NoFocus)
# The row reaches below the floor by the text's descent (so the
@@ -670,7 +670,7 @@ class TransportBar(QWidget):
button.refresh_icons()
box_bg = theme.gray(theme.gray_value(self._prefs, "color_button"))
for box in self._boxes:
box.setStyleSheet(_box_style(box_bg, button=not box.property("tiles")))
box.setStyleSheet(_box_style(box_bg))
self._apply_now_playing_bg()
self._apply_now_playing_font()
self._visualizer.update() # dim-mode bar color may have changed