diff --git a/CLAUDE.md b/CLAUDE.md index 62c42f9..17e0240 100644 --- a/CLAUDE.md +++ b/CLAUDE.md @@ -235,7 +235,10 @@ persistence) → GUI (Qt widgets that read the manager and connect to its signal face is a `face` property, since a QFrame has no `:pressed`. **No pointing-hand (finger) cursor anywhere** (trav's call, Round 110): most of the app is clickable, so a finger on a few things misleads. He - may want it on *every* button later — all or nothing. + may want it on *every* button later — all or nothing. So a thing that's + clickable must *look* it: the version button is flat until an update is + ready, then shows the button face on hover; the status bar's cancel ✕ and + the DJ deck's cancel-split ✕ are always drawn as buttons. The playlist list's frame is a `sidebar.RoundedFrame` (Round 91): the panels' 8 px corners, painted *over* the list by a mouse-transparent overlay (window color outside the curve, then Fusion's own frame line, diff --git a/lintunes/__init__.py b/lintunes/__init__.py index 6282d89..35dbf87 100644 --- a/lintunes/__init__.py +++ b/lintunes/__init__.py @@ -1,3 +1,3 @@ """LinTunes — iTunes-style music library manager and player for Linux.""" -__version__ = "0.79.1" +__version__ = "0.79.2" diff --git a/lintunes/gui/dj_shelf.py b/lintunes/gui/dj_shelf.py index 56e9337..94d19ed 100644 --- a/lintunes/gui/dj_shelf.py +++ b/lintunes/gui/dj_shelf.py @@ -1280,11 +1280,14 @@ class DjShelf(QWidget): stop = QToolButton() stop.setText("✕") stop.setToolTip("cancel vocals split") - stop.setAutoRaise(True) stop.setFocusPolicy(Qt.FocusPolicy.NoFocus) - stop.setStyleSheet(f"QToolButton {{ color: {DIM}; font-size: 10px; border: none;" - f" padding: 0 2px; background: transparent; }}" - f"QToolButton:hover {{ color: #f4f4f4; }}") + # Always a button: the horn's face, shrunk to the note's size. + stop.setStyleSheet( + "QToolButton { color: #e8e8e8; font-size: 10px; padding: 0 3px;" + " border: 1px solid #111; border-radius: 4px; background:" + " qlineargradient(x1:0,y1:0,x2:0,y2:1, stop:0 #5a5c5f, stop:1 #3d3f42); }" + "QToolButton:hover { background: #4a4c4f; }" + "QToolButton:pressed { background: #2a2b2d; }") stop.clicked.connect(lambda _=False, v=v: self.cancel_split(v)) stop.hide() note_line = QHBoxLayout() diff --git a/lintunes/gui/main_window.py b/lintunes/gui/main_window.py index f4f7a93..4519382 100644 --- a/lintunes/gui/main_window.py +++ b/lintunes/gui/main_window.py @@ -81,14 +81,14 @@ class _StatusLabel(QLabel): class _CancelSyncButton(QPushButton): """Compact "✕" in the status bar's right corner that expands to say what it does ("cancel transfer") while hovered, then shrinks back. Expanding - pushes the progress bar and label left; the button itself stays put.""" + pushes the progress bar and label left; the button itself stays put. + Always the shared button face, only shrunk to fit the status bar.""" def __init__(self, parent=None): super().__init__(parent) - self.setFlat(True) self.setFocusPolicy(Qt.FocusPolicy.NoFocus) self.setToolTip("Cancel the transfer") - self.setStyleSheet("QPushButton { border: none; padding: 0 4px; }") + self.setStyleSheet("QPushButton { padding: 0 4px; min-height: 0; }") self._apply("✕") def _apply(self, text: str): diff --git a/lintunes/gui/version_button.py b/lintunes/gui/version_button.py index 1e04570..88d438a 100644 --- a/lintunes/gui/version_button.py +++ b/lintunes/gui/version_button.py @@ -2,12 +2,14 @@ Normally an inert label ("v0.1.0"; tooltip shows the git commit so identical versions on different machines are still distinguishable). When the Updater -finds upstream commits it grows a "*" and becomes a button: click → confirm → +finds upstream commits it grows a "*" and becomes a button — still flat, but +the button face shows under the cursor and sinks while held: click → confirm → git pull → the main window restarts the app on `update_applied`. """ from PyQt6.QtCore import Qt, QTimer, pyqtSignal -from PyQt6.QtWidgets import QMessageBox, QPushButton +from PyQt6.QtGui import QPalette +from PyQt6.QtWidgets import QApplication, QMessageBox, QPushButton from lintunes import __version__, theme @@ -47,12 +49,22 @@ class VersionButton(QPushButton): # From the theme, never self.palette(): this stylesheet pins that, # so the color it gave at launch survived every light/dark switch. text = theme.text_color() - self.setStyleSheet( - "QPushButton { border: none; padding: 0 6px; " - f"color: rgba({text.red()}, {text.green()}, {text.blue()}, 140); }}") + qss = ("QPushButton { border: 1px solid transparent; padding: 0 6px; " + f"border-radius: {theme.BUTTON_RADIUS}px; " + f"color: rgba({text.red()}, {text.green()}, {text.blue()}, 140); }}") + if self._update_ready: + face = QApplication.palette().color(QPalette.ColorRole.Button) + hover = face.darker(theme.HOVER_DARKER) + down = face.darker(theme.PRESSED_DARKER) + qss += (f"QPushButton:hover {{ {theme.emboss_edges(hover)}" + f" background: {theme.emboss_gradient(hover)}; }}" + f"QPushButton:pressed {{ {theme.emboss_edges(down)}" + f" background: {theme.emboss_gradient(down, pressed=True)}; }}") + self.setStyleSheet(qss) def _on_update_available(self, commits: int): self._update_ready = True + self.refresh_theme() self.setText(f"v{__version__}*") noun = "commit" if commits == 1 else "commits" self.setToolTip(f"Update available ({commits} {noun}) — " diff --git a/tests/test_round110.py b/tests/test_round110.py index d6b7015..e849105 100644 --- a/tests/test_round110.py +++ b/tests/test_round110.py @@ -83,3 +83,29 @@ def test_window_wires_it_to_go_to_current_song(qapp, tmp_path, monkeypatch): assert panel._clickable finally: window.close() + + +def test_version_button_shows_a_face_on_hover_only_once_an_update_is_ready(qapp): + from PyQt6.QtCore import QObject, pyqtSignal + from lintunes.gui.version_button import VersionButton + + class Updater(QObject): + update_available = pyqtSignal(int) + update_failed = pyqtSignal(str) + + def short_hash(self): + return "" + + button = VersionButton(Updater()) + assert ":hover" not in button.styleSheet() # an inert readout + button._on_update_available(3) + assert ":hover" in button.styleSheet() and ":pressed" in button.styleSheet() + button.refresh_theme() # a theme switch keeps it + assert ":hover" in button.styleSheet() + + +def test_cancel_transfer_is_always_a_button(qapp): + from lintunes.gui.main_window import _CancelSyncButton + button = _CancelSyncButton() + assert not button.isFlat() + assert "border: none" not in button.styleSheet()