forked from trav/lintunes
v0.79.2: the version button shows a button face on hover once an update is ready; both cancel ✕s are always buttons
This commit is contained in:
@@ -1,3 +1,3 @@
|
||||
"""LinTunes — iTunes-style music library manager and player for Linux."""
|
||||
|
||||
__version__ = "0.79.1"
|
||||
__version__ = "0.79.2"
|
||||
|
||||
@@ -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()
|
||||
|
||||
@@ -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):
|
||||
|
||||
@@ -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}) — "
|
||||
|
||||
Reference in New Issue
Block a user