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:
@@ -164,7 +164,7 @@ class TestEmboss:
|
||||
sidebar = SidebarPanel(manager, MagicMock())
|
||||
for qss in (sidebar.library_button.styleSheet(),
|
||||
sidebar.friend_button.styleSheet(),
|
||||
_box_style(QColor("#dddddd"), button=True),
|
||||
_box_style(QColor("#dddddd")),
|
||||
cassette_art.friend_button_qss()):
|
||||
assert ":hover" in qss
|
||||
assert "border-bottom-color" in qss
|
||||
|
||||
@@ -0,0 +1,81 @@
|
||||
"""Round 92: a twice-as-tall scrubber, buttons that darken clearly while
|
||||
held (the transport's included — the play box is three touching buttons),
|
||||
and the album art's border a crisp 1 px of the lists' grey."""
|
||||
|
||||
from types import SimpleNamespace
|
||||
from unittest.mock import MagicMock
|
||||
|
||||
from PyQt6.QtCore import Qt
|
||||
from PyQt6.QtGui import QColor, QPixmap
|
||||
from PyQt6.QtWidgets import QSlider, QStyle, QStyleOptionSlider
|
||||
|
||||
from lintunes import theme
|
||||
from tests.test_round49 import _FakePlayer
|
||||
|
||||
|
||||
def _rects(qapp, tall):
|
||||
from lintunes.gui.track_table import ClickToJumpScrollStyle
|
||||
style = ClickToJumpScrollStyle()
|
||||
slider = QSlider(Qt.Orientation.Horizontal)
|
||||
slider.setStyle(style)
|
||||
slider.setProperty("tall", tall)
|
||||
slider.resize(200, slider.sizeHint().height())
|
||||
option = QStyleOptionSlider()
|
||||
slider.initStyleOption(option)
|
||||
cc, sc = QStyle.ComplexControl.CC_Slider, QStyle.SubControl
|
||||
return (slider.sizeHint().height(),
|
||||
style.subControlRect(cc, option, sc.SC_SliderGroove, slider),
|
||||
style.subControlRect(cc, option, sc.SC_SliderHandle, slider))
|
||||
|
||||
|
||||
def test_the_scrubber_is_twice_as_tall(qapp):
|
||||
hint, groove, handle = _rects(qapp, False)
|
||||
tall_hint, tall_groove, tall_handle = _rects(qapp, True)
|
||||
assert tall_hint == 2 * hint
|
||||
assert tall_groove.height() == 2 * groove.height()
|
||||
assert tall_handle.height() == 2 * handle.height()
|
||||
assert tall_handle.width() == handle.width()
|
||||
assert tall_handle.top() >= 0
|
||||
|
||||
|
||||
def test_held_is_clearly_darker_than_hover():
|
||||
assert theme.PRESSED_DARKER - 100 >= 2 * (theme.HOVER_DARKER - 100)
|
||||
qss = theme.button_face_qss("QPushButton", QColor("#c0c0c0"))
|
||||
pressed = qss.split("QPushButton:pressed {", 1)[1].split("}", 1)[0]
|
||||
assert QColor("#c0c0c0").darker(theme.PRESSED_DARKER).name() in pressed
|
||||
|
||||
|
||||
def test_transport_buttons_carry_their_own_face(qapp):
|
||||
from lintunes.gui.transport import TransportBar
|
||||
from lintunes.preferences import Preferences
|
||||
import tempfile
|
||||
from pathlib import Path
|
||||
player = MagicMock()
|
||||
player.repeat_mode.return_value = "off"
|
||||
with tempfile.TemporaryDirectory() as d:
|
||||
bar = TransportBar(player, MagicMock(), Preferences(Path(d)))
|
||||
assert [b.property("tile") for b in
|
||||
(bar._prev_btn, bar._play_btn, bar._next_btn)] == [
|
||||
"first", "middle", "last"]
|
||||
assert bar._shuffle_btn.property("tile") is None
|
||||
qss = bar._shuffle_btn.parentWidget().styleSheet()
|
||||
assert "QFrame#transportBox > QToolButton:pressed" in qss
|
||||
assert "QFrame#transportBox > QToolButton:hover" in qss
|
||||
assert "rgba(" not in qss # no grey patch on hover
|
||||
|
||||
|
||||
def test_the_art_meets_one_pixel_of_frame_grey(qapp):
|
||||
from lintunes.gui.sidebar import NO_ART_GAP, SidebarArt, frame_color
|
||||
art = SidebarArt(_FakePlayer())
|
||||
art.resize(100, 100 + NO_ART_GAP)
|
||||
pink = QPixmap(50, 50)
|
||||
pink.fill(QColor("#e8457a"))
|
||||
art._track = SimpleNamespace(track_id=1)
|
||||
art._pixmap = pink
|
||||
image = art.grab().toImage()
|
||||
middle = NO_ART_GAP + 50
|
||||
line = frame_color(art.palette()).name()
|
||||
assert image.pixelColor(0, middle).name() == line
|
||||
assert image.pixelColor(1, middle).name() == "#e8457a"
|
||||
assert image.pixelColor(50, NO_ART_GAP).name() == line
|
||||
assert image.pixelColor(50, NO_ART_GAP + 1).name() == "#e8457a"
|
||||
Reference in New Issue
Block a user