Cosmetic fixes; fixed bug with reflow
This commit is contained in:
@@ -67,7 +67,7 @@ class AlbumsGrid(CoverArtGrid):
|
||||
return AlbumModel(album)
|
||||
|
||||
def create_detail_element_from_model(self, album: AlbumModel):
|
||||
return AlbumWithSongs(album.album)
|
||||
return AlbumWithSongs(album.album, cover_art_size=300)
|
||||
|
||||
def get_cover_art_filename_future(self, item, before_download):
|
||||
return CacheManager.get_cover_art_filename(
|
||||
|
@@ -146,8 +146,6 @@
|
||||
|
||||
#artist-album-list-artwork {
|
||||
margin: 10px;
|
||||
min-width: 200px;
|
||||
min-height: 200px;
|
||||
}
|
||||
|
||||
#artist-album-list-album-name {
|
||||
|
@@ -378,7 +378,7 @@ class AlbumsListWithSongs(Gtk.Overlay):
|
||||
self.box.remove(c)
|
||||
|
||||
for album in artist.get('album', artist.get('child', [])):
|
||||
album_with_songs = AlbumWithSongs(album)
|
||||
album_with_songs = AlbumWithSongs(album, show_artist_name=False)
|
||||
album_with_songs.connect(
|
||||
'song-clicked',
|
||||
lambda _, song, queue: self.emit('song-clicked', song, queue),
|
||||
|
@@ -30,7 +30,7 @@ class AlbumWithSongs(Gtk.Box):
|
||||
),
|
||||
}
|
||||
|
||||
def __init__(self, album):
|
||||
def __init__(self, album, cover_art_size=200, show_artist_name=True):
|
||||
Gtk.Box.__init__(self, orientation=Gtk.Orientation.HORIZONTAL)
|
||||
self.album = album
|
||||
|
||||
@@ -40,6 +40,9 @@ class AlbumWithSongs(Gtk.Box):
|
||||
image_name='artist-album-list-artwork',
|
||||
spinner_name='artist-artwork-spinner',
|
||||
)
|
||||
# Account for 10px margin on all sides with "+ 20".
|
||||
artist_artwork.set_size_request(cover_art_size + 20,
|
||||
cover_art_size + 20)
|
||||
box.pack_start(artist_artwork, False, False, 0)
|
||||
box.pack_start(Gtk.Box(), True, True, 0)
|
||||
self.pack_start(box, False, False, 0)
|
||||
@@ -51,7 +54,7 @@ class AlbumWithSongs(Gtk.Box):
|
||||
cover_art_filename_future = CacheManager.get_cover_art_filename(
|
||||
album.coverArt,
|
||||
before_download=lambda: artist_artwork.set_loading(True),
|
||||
size=200,
|
||||
size=cover_art_size,
|
||||
)
|
||||
cover_art_filename_future.add_done_callback(
|
||||
lambda f: GLib.idle_add(cover_art_future_done, f))
|
||||
@@ -64,9 +67,16 @@ class AlbumWithSongs(Gtk.Box):
|
||||
halign=Gtk.Align.START,
|
||||
))
|
||||
|
||||
stats = [album.year, album.genre]
|
||||
if album.get('duration'):
|
||||
stats.append(util.format_sequence_duration(album.duration))
|
||||
stats = [
|
||||
album.artist if show_artist_name else None,
|
||||
album.year,
|
||||
album.genre,
|
||||
|
||||
# TODO when not available (not browse by tags), calculate after the
|
||||
# list loads and update the stats label.
|
||||
util.format_sequence_duration(album.duration)
|
||||
if album.get('duration') else None,
|
||||
]
|
||||
|
||||
album_details.add(
|
||||
Gtk.Label(
|
||||
|
@@ -208,8 +208,8 @@ class CoverArtGrid(Gtk.ScrolledWindow):
|
||||
del self.list_store_bottom[0]
|
||||
else:
|
||||
# Move entries to the bottom store.
|
||||
for e in self.list_store_top[entries_before_fold:]:
|
||||
self.list_store_bottom.append(e)
|
||||
for e in reversed(self.list_store_top[entries_before_fold:]):
|
||||
self.list_store_bottom.insert(0, e)
|
||||
for _ in range(top_diff):
|
||||
del self.list_store_top[-1]
|
||||
|
||||
|
Reference in New Issue
Block a user