v0.24.0: click the blank cover
Clicking the gray sidebar art square (playing track has no embedded art) now opens Download Album Art for that track, same as the right-click menu. Once art is embedded the square refreshes and a click opens the big view again.
This commit is contained in:
@@ -1,3 +1,3 @@
|
||||
"""LinTunes — iTunes-style music library manager and player for Linux."""
|
||||
|
||||
__version__ = "0.23.0"
|
||||
__version__ = "0.24.0"
|
||||
|
||||
@@ -206,6 +206,8 @@ class MainWindow(QMainWindow):
|
||||
self._sidebar.library_selected.connect(self._show_library)
|
||||
self._sidebar.playlist_selected.connect(self._show_playlist)
|
||||
self._sidebar.tree.export_requested.connect(self._export_playlist)
|
||||
self._sidebar.art.download_art_requested.connect(
|
||||
lambda tid: self._download_album_art([tid]))
|
||||
self._content.currentChanged.connect(self._update_totals)
|
||||
for view in (self._library_view, self._playlist_view):
|
||||
view.play_requested.connect(
|
||||
@@ -1399,7 +1401,11 @@ class MainWindow(QMainWindow):
|
||||
self, "Download Album Art",
|
||||
"Couldn't embed artwork in some files:\n\n"
|
||||
+ "\n".join(failures[:10]))
|
||||
elif done:
|
||||
if done:
|
||||
# Normally track_updated already did this, but only when the
|
||||
# file's size changed.
|
||||
self._sidebar.art.refresh()
|
||||
if done and not failures:
|
||||
noun = "track" if done == 1 else "tracks"
|
||||
self.statusBar().showMessage(
|
||||
f"Artwork embedded in {done} {noun}", 5000)
|
||||
|
||||
+16
-6
@@ -88,7 +88,10 @@ class SidebarPanel(QWidget):
|
||||
|
||||
class SidebarArt(QWidget):
|
||||
"""Square album art pinned to the sidebar bottom; gray square when the
|
||||
current track has no embedded art. A click opens the big art window."""
|
||||
current track has no embedded art. A click opens the big art window, or,
|
||||
on the gray square, asks for the track's art to be downloaded."""
|
||||
|
||||
download_art_requested = pyqtSignal(int) # track id
|
||||
|
||||
def __init__(self, player, parent=None):
|
||||
super().__init__(parent)
|
||||
@@ -96,7 +99,6 @@ class SidebarArt(QWidget):
|
||||
self._pixmap: QPixmap | None = None
|
||||
self._track = None
|
||||
self._art_window = ArtWindow()
|
||||
self.setToolTip("Click to view full size")
|
||||
player.track_changed.connect(self.set_track)
|
||||
|
||||
def set_track(self, track):
|
||||
@@ -108,6 +110,12 @@ class SidebarArt(QWidget):
|
||||
pixmap = QPixmap()
|
||||
if pixmap.loadFromData(data):
|
||||
self._pixmap = pixmap
|
||||
if self._pixmap is not None:
|
||||
self.setToolTip("Click to view full size")
|
||||
elif track is not None:
|
||||
self.setToolTip("Click to download album art")
|
||||
else:
|
||||
self.setToolTip("")
|
||||
if self._art_window.isVisible():
|
||||
self._art_window.set_artwork(self._pixmap, self._title())
|
||||
self.update()
|
||||
@@ -132,10 +140,12 @@ class SidebarArt(QWidget):
|
||||
# A click is a release that lands on the art. Opening on press would
|
||||
# also fire when a drag merely starts here.
|
||||
if (event.button() == Qt.MouseButton.LeftButton
|
||||
and self.rect().contains(event.position().toPoint())
|
||||
and self._pixmap is not None):
|
||||
self._art_window.show_artwork(self._pixmap, self._title(),
|
||||
self.screen())
|
||||
and self.rect().contains(event.position().toPoint())):
|
||||
if self._pixmap is not None:
|
||||
self._art_window.show_artwork(self._pixmap, self._title(),
|
||||
self.screen())
|
||||
elif self._track is not None:
|
||||
self.download_art_requested.emit(self._track.track_id)
|
||||
super().mouseReleaseEvent(event)
|
||||
|
||||
def paintEvent(self, event):
|
||||
|
||||
Reference in New Issue
Block a user