Album text improvement; cover art grid spinner

This commit is contained in:
Sumner Evans
2019-08-02 08:40:49 -06:00
parent c84ddcd476
commit a04fe75738
3 changed files with 35 additions and 7 deletions

View File

@@ -59,7 +59,7 @@
}
/* ********** Playback Controls ********** */
#player-controls-album-artwork #player-controls-album-artwork {
#player-controls-album-artwork {
min-height: 70px;
min-width: 70px;
}
@@ -120,6 +120,11 @@
margin: 10px;
}
#grid-spinner {
min-height: 50px;
min-width: 50px;
}
#grid-header-label {
margin-left: 10px;
margin-right: 10px;

View File

@@ -88,8 +88,10 @@ class ArtistList(Gtk.Box):
list_scroll_window = Gtk.ScrolledWindow(min_content_width=220)
self.list = Gtk.ListBox(name='artist-list-listbox')
self.loading_indicator = Gtk.ListBoxRow(activatable=False,
selectable=False)
self.loading_indicator = Gtk.ListBoxRow(
activatable=False,
selectable=False,
)
loading_spinner = Gtk.Spinner(name='artist-list-spinner', active=True)
self.loading_indicator.add(loading_spinner)
self.list.add(self.loading_indicator)
@@ -123,9 +125,18 @@ class ArtistList(Gtk.Box):
if selected_artist and artist.id == selected_artist.id:
selected_idx = i + 1
self.artist_map[i + 1] = artist
label_text = [f'<b>{util.esc(artist.name)}</b>']
album_count = artist.get('albumCount')
if album_count:
label_text.append('{} {}'.format(
album_count, util.pluralize('album', album_count)))
self.list.add(
Gtk.Label(
label=artist.name,
label='\n'.join(label_text),
use_markup=True,
margin=12,
halign=Gtk.Align.START,
ellipsize=Pango.EllipsizeMode.END,

View File

@@ -21,6 +21,7 @@ class CoverArtGrid(Gtk.ScrolledWindow):
def __init__(self, *args, **kwargs):
super().__init__(*args, **kwargs)
overlay = Gtk.Overlay()
self.grid = Gtk.FlowBox(
vexpand=True,
hexpand=True,
@@ -37,17 +38,28 @@ class CoverArtGrid(Gtk.ScrolledWindow):
self.model = Gio.ListStore()
self.grid.bind_model(self.model, self.create_widget)
self.add(self.grid)
overlay.add(self.grid)
self.spinner = Gtk.Spinner(
name='',
active=True,
halign=Gtk.Align.CENTER,
valign=Gtk.Align.CENTER,
)
overlay.add_overlay(self.spinner)
self.add(overlay)
def update(self, state: ApplicationState = None):
self.update_grid()
def update_grid(self):
def start_loading():
print('set loading')
self.spinner.show()
def stop_loading():
print('stop loading')
self.spinner.hide()
def future_done(f):
try: