Added error text for albums and playlists; made the icon and text horizontal
This commit is contained in:
@@ -221,7 +221,8 @@
|
|||||||
|
|
||||||
#load-error-image,
|
#load-error-image,
|
||||||
#load-error-label {
|
#load-error-label {
|
||||||
margin-bottom: 10px;
|
margin-bottom: 5px;
|
||||||
|
margin-right: 20px;
|
||||||
}
|
}
|
||||||
|
|
||||||
/* ********** Artists & Albums ********** */
|
/* ********** Artists & Albums ********** */
|
||||||
|
@@ -141,7 +141,9 @@ class ArtistList(Gtk.Box):
|
|||||||
"Artist list",
|
"Artist list",
|
||||||
"load artists",
|
"load artists",
|
||||||
has_data=len(artists) > 0,
|
has_data=len(artists) > 0,
|
||||||
offline_mode=self._app_config.offline_mode,
|
offline_mode=(
|
||||||
|
self._app_config.offline_mode if self._app_config else False
|
||||||
|
),
|
||||||
)
|
)
|
||||||
self.error_container.pack_start(load_error, True, True, 0)
|
self.error_container.pack_start(load_error, True, True, 0)
|
||||||
self.error_container.show_all()
|
self.error_container.show_all()
|
||||||
@@ -300,6 +302,9 @@ class ArtistDetailPanel(Gtk.Box):
|
|||||||
|
|
||||||
self.pack_start(self.big_info_panel, False, True, 0)
|
self.pack_start(self.big_info_panel, False, True, 0)
|
||||||
|
|
||||||
|
self.error_container = Gtk.Box()
|
||||||
|
self.add(self.error_container)
|
||||||
|
|
||||||
self.album_list_scrolledwindow = Gtk.ScrolledWindow()
|
self.album_list_scrolledwindow = Gtk.ScrolledWindow()
|
||||||
self.albums_list = AlbumsListWithSongs()
|
self.albums_list = AlbumsListWithSongs()
|
||||||
self.albums_list.connect(
|
self.albums_list.connect(
|
||||||
@@ -310,6 +315,7 @@ class ArtistDetailPanel(Gtk.Box):
|
|||||||
|
|
||||||
def update(self, app_config: AppConfiguration):
|
def update(self, app_config: AppConfiguration):
|
||||||
self.artist_id = app_config.state.selected_artist_id
|
self.artist_id = app_config.state.selected_artist_id
|
||||||
|
self.offline_mode = app_config.offline_mode
|
||||||
if app_config.state.selected_artist_id is None:
|
if app_config.state.selected_artist_id is None:
|
||||||
self.big_info_panel.hide()
|
self.big_info_panel.hide()
|
||||||
self.album_list_scrolledwindow.hide()
|
self.album_list_scrolledwindow.hide()
|
||||||
@@ -322,8 +328,8 @@ class ArtistDetailPanel(Gtk.Box):
|
|||||||
app_config=app_config,
|
app_config=app_config,
|
||||||
order_token=self.update_order_token,
|
order_token=self.update_order_token,
|
||||||
)
|
)
|
||||||
self.refresh_button.set_sensitive(not app_config.offline_mode)
|
self.refresh_button.set_sensitive(not self.offline_mode)
|
||||||
self.download_all_button.set_sensitive(not app_config.offline_mode)
|
self.download_all_button.set_sensitive(not self.offline_mode)
|
||||||
|
|
||||||
@util.async_callback(
|
@util.async_callback(
|
||||||
AdapterManager.get_artist,
|
AdapterManager.get_artist,
|
||||||
@@ -398,6 +404,24 @@ class ArtistDetailPanel(Gtk.Box):
|
|||||||
artist.artist_image_url, force=force, order_token=order_token,
|
artist.artist_image_url, force=force, order_token=order_token,
|
||||||
)
|
)
|
||||||
|
|
||||||
|
for c in self.error_container.get_children():
|
||||||
|
self.error_container.remove(c)
|
||||||
|
if is_partial:
|
||||||
|
has_data = len(artist.albums or []) > 0
|
||||||
|
load_error = LoadError(
|
||||||
|
"Artist data",
|
||||||
|
"load artist details",
|
||||||
|
has_data=has_data,
|
||||||
|
offline_mode=self.offline_mode,
|
||||||
|
)
|
||||||
|
self.error_container.pack_start(load_error, True, True, 0)
|
||||||
|
self.error_container.show_all()
|
||||||
|
if not has_data:
|
||||||
|
self.album_list_scrolledwindow.hide()
|
||||||
|
else:
|
||||||
|
self.error_container.hide()
|
||||||
|
self.album_list_scrolledwindow.show()
|
||||||
|
|
||||||
self.albums = artist.albums or []
|
self.albums = artist.albums or []
|
||||||
self.albums_list.update(artist, app_config, force=force)
|
self.albums_list.update(artist, app_config, force=force)
|
||||||
|
|
||||||
|
@@ -15,7 +15,9 @@ class LoadError(Gtk.Box):
|
|||||||
|
|
||||||
inner_box.pack_start(Gtk.Box(), True, True, 0)
|
inner_box.pack_start(Gtk.Box(), True, True, 0)
|
||||||
|
|
||||||
error_description_box = Gtk.Box(orientation=Gtk.Orientation.VERTICAL)
|
error_and_button_box = Gtk.Box(orientation=Gtk.Orientation.VERTICAL)
|
||||||
|
|
||||||
|
icon_and_button_box = Gtk.Box(orientation=Gtk.Orientation.HORIZONTAL)
|
||||||
|
|
||||||
if offline_mode:
|
if offline_mode:
|
||||||
icon_name = "cloud-offline-symbolic"
|
icon_name = "cloud-offline-symbolic"
|
||||||
@@ -27,30 +29,28 @@ class LoadError(Gtk.Box):
|
|||||||
|
|
||||||
image = Gtk.Image.new_from_icon_name(icon_name, Gtk.IconSize.DIALOG)
|
image = Gtk.Image.new_from_icon_name(icon_name, Gtk.IconSize.DIALOG)
|
||||||
image.set_name("load-error-image")
|
image.set_name("load-error-image")
|
||||||
error_description_box.add(image)
|
icon_and_button_box.add(image)
|
||||||
|
|
||||||
error_description_box.add(
|
icon_and_button_box.add(Gtk.Label(label=label, name="load-error-label"))
|
||||||
Gtk.Label(
|
|
||||||
label=label, justify=Gtk.Justification.CENTER, name="load-error-label"
|
|
||||||
)
|
|
||||||
)
|
|
||||||
|
|
||||||
box = Gtk.Box()
|
error_and_button_box.add(icon_and_button_box)
|
||||||
box.pack_start(Gtk.Box(), True, True, 0)
|
|
||||||
|
button_centerer_box = Gtk.Box()
|
||||||
|
button_centerer_box.pack_start(Gtk.Box(), True, True, 0)
|
||||||
|
|
||||||
if offline_mode:
|
if offline_mode:
|
||||||
go_online_button = Gtk.Button(label="Go Online")
|
go_online_button = Gtk.Button(label="Go Online")
|
||||||
go_online_button.set_action_name("app.go-online")
|
go_online_button.set_action_name("app.go-online")
|
||||||
box.add(go_online_button)
|
button_centerer_box.add(go_online_button)
|
||||||
else:
|
else:
|
||||||
retry_button = Gtk.Button(label="Retry")
|
retry_button = Gtk.Button(label="Retry")
|
||||||
retry_button.set_action_name("app.refresh-window")
|
retry_button.set_action_name("app.refresh-window")
|
||||||
box.add(retry_button)
|
button_centerer_box.add(retry_button)
|
||||||
|
|
||||||
box.pack_start(Gtk.Box(), True, True, 0)
|
button_centerer_box.pack_start(Gtk.Box(), True, True, 0)
|
||||||
error_description_box.add(box)
|
error_and_button_box.add(button_centerer_box)
|
||||||
|
|
||||||
inner_box.add(error_description_box)
|
inner_box.add(error_and_button_box)
|
||||||
|
|
||||||
inner_box.pack_start(Gtk.Box(), True, True, 0)
|
inner_box.pack_start(Gtk.Box(), True, True, 0)
|
||||||
|
|
||||||
|
@@ -1,3 +1,3 @@
|
|||||||
<svg xmlns="http://www.w3.org/2000/svg" width="24" height="24">
|
<svg xmlns="http://www.w3.org/2000/svg" width="24" height="24">
|
||||||
<path fill="#dcdcdc" d="M3.42 2.38a1.04 1.04 0 00-.73 1.77l2.8 2.81L18 19.46l1.88 1.88a1.04 1.04 0 101.47-1.47l-.97-.96L7.12 5.65 4.15 2.68c-.2-.2-.47-.3-.73-.3zm7.53 2.17c-1.08.01-2.11.25-3.04.68l13.24 13.24A5.77 5.77 0 0017.4 7.93a7.62 7.62 0 00-6.44-3.38zm-6 3.08A7.59 7.59 0 003.5 11.1a4.2 4.2 0 00.98 8.3l12.28.04L4.94 7.63z"/>
|
<path d="M3.42 2.38a1.04 1.04 0 00-.73 1.77l2.8 2.81L18 19.46l1.88 1.88a1.04 1.04 0 101.47-1.47l-.97-.96L7.12 5.65 4.15 2.68c-.2-.2-.47-.3-.73-.3zm7.53 2.17c-1.08.01-2.11.25-3.04.68l13.24 13.24A5.77 5.77 0 0017.4 7.93a7.62 7.62 0 00-6.44-3.38zm-6 3.08A7.59 7.59 0 003.5 11.1a4.2 4.2 0 00.98 8.3l12.28.04L4.94 7.63z"/>
|
||||||
</svg>
|
</svg>
|
||||||
|
Before Width: | Height: | Size: 406 B After Width: | Height: | Size: 391 B |
@@ -370,8 +370,11 @@ class PlaylistDetailPanel(Gtk.Overlay):
|
|||||||
|
|
||||||
self.playlist_box.add(playlist_info_box)
|
self.playlist_box.add(playlist_info_box)
|
||||||
|
|
||||||
|
self.error_container = Gtk.Box()
|
||||||
|
self.playlist_box.add(self.error_container)
|
||||||
|
|
||||||
# Playlist songs list
|
# Playlist songs list
|
||||||
playlist_view_scroll_window = Gtk.ScrolledWindow()
|
self.playlist_song_scroll_window = Gtk.ScrolledWindow()
|
||||||
|
|
||||||
self.playlist_song_store = Gtk.ListStore(
|
self.playlist_song_store = Gtk.ListStore(
|
||||||
bool, # clickable
|
bool, # clickable
|
||||||
@@ -442,9 +445,9 @@ class PlaylistDetailPanel(Gtk.Overlay):
|
|||||||
)
|
)
|
||||||
self.playlist_song_store.connect("row-deleted", self.on_playlist_model_row_move)
|
self.playlist_song_store.connect("row-deleted", self.on_playlist_model_row_move)
|
||||||
|
|
||||||
playlist_view_scroll_window.add(self.playlist_songs)
|
self.playlist_song_scroll_window.add(self.playlist_songs)
|
||||||
|
|
||||||
self.playlist_box.pack_start(playlist_view_scroll_window, True, True, 0)
|
self.playlist_box.pack_start(self.playlist_song_scroll_window, True, True, 0)
|
||||||
self.add(self.playlist_box)
|
self.add(self.playlist_box)
|
||||||
|
|
||||||
playlist_view_spinner = Gtk.Spinner(active=True)
|
playlist_view_spinner = Gtk.Spinner(active=True)
|
||||||
@@ -543,6 +546,24 @@ class PlaylistDetailPanel(Gtk.Overlay):
|
|||||||
# Update the artwork.
|
# Update the artwork.
|
||||||
self.update_playlist_artwork(playlist.cover_art, order_token=order_token)
|
self.update_playlist_artwork(playlist.cover_art, order_token=order_token)
|
||||||
|
|
||||||
|
for c in self.error_container.get_children():
|
||||||
|
self.error_container.remove(c)
|
||||||
|
if is_partial:
|
||||||
|
has_data = len(playlist.songs) > 0
|
||||||
|
load_error = LoadError(
|
||||||
|
"Playlist data",
|
||||||
|
"load playlist details",
|
||||||
|
has_data=has_data,
|
||||||
|
offline_mode=self.offline_mode,
|
||||||
|
)
|
||||||
|
self.error_container.pack_start(load_error, True, True, 0)
|
||||||
|
self.error_container.show_all()
|
||||||
|
if not has_data:
|
||||||
|
self.playlist_song_scroll_window.hide()
|
||||||
|
else:
|
||||||
|
self.error_container.hide()
|
||||||
|
self.playlist_song_scroll_window.show()
|
||||||
|
|
||||||
# Update the song list model. This requires some fancy diffing to
|
# Update the song list model. This requires some fancy diffing to
|
||||||
# update the list.
|
# update the list.
|
||||||
self.editing_playlist_song_list = True
|
self.editing_playlist_song_list = True
|
||||||
|
Reference in New Issue
Block a user