Commit 4c58af43 authored by Suyash Garg's avatar Suyash Garg Committed by Marinus Schraal

baseview: Cleanup

Make the code follow PEP-8 & PEP-257 recommendations, this work also
includes derived classes for as much as is needed.

https://bugzilla.gnome.org/show_bug.cgi?id=774449
parent 2b743afd
......@@ -53,7 +53,7 @@ class AlbumsView(BaseView):
@log
def _on_changes_pending(self, data=None):
if (self._init and not self.header_bar._selectionMode):
if (self._init and not self._header_bar._selectionMode):
self._offset = 0
self._init = True
GLib.idle_add(self.populate)
......@@ -61,13 +61,13 @@ class AlbumsView(BaseView):
@log
def _on_selection_mode_changed(self, widget, data=None):
if (not self.header_bar._selectionMode
if (not self._header_bar._selectionMode
and grilo.changes_pending['Albums']):
self._on_changes_pending()
@log
def _setup_view(self, view_type):
self.view = Gtk.FlowBox(homogeneous=True,
self._view = Gtk.FlowBox(homogeneous=True,
hexpand=True,
halign=Gtk.Align.FILL,
valign=Gtk.Align.START,
......@@ -78,25 +78,25 @@ class AlbumsView(BaseView):
min_children_per_line=1,
max_children_per_line=25)
self.view.connect('child-activated', self._on_child_activated)
self._view.connect('child-activated', self._on_child_activated)
scrolledwin = Gtk.ScrolledWindow()
scrolledwin.add(self.view)
scrolledwin.add(self._view)
scrolledwin.show()
self._box.add(scrolledwin)
@log
def _back_button_clicked(self, widget, data=None):
self.header_bar.reset_header_title()
self._header_bar.reset_header_title()
self.set_visible_child(self._grid)
@log
def _on_child_activated(self, widget, child, user_data=None):
item = child.media_item
if self.star_handler.star_renderer_click:
self.star_handler.star_renderer_click = False
if self._star_handler.star_renderer_click:
self._star_handler.star_renderer_click = False
return
# Toggle the selection when in selection mode
......@@ -109,28 +109,28 @@ class AlbumsView(BaseView):
self._artist = utils.get_artist_name(item)
self._albumWidget.update(self._artist, title, item,
self.header_bar, self.selection_toolbar)
self._header_bar, self._selection_toolbar)
self.header_bar.set_state(ToolbarState.CHILD_VIEW)
self.header_bar.header_bar.set_title(self._escaped_title)
self.header_bar.header_bar.sub_title = self._artist
self._header_bar.set_state(ToolbarState.CHILD_VIEW)
self._header_bar.header_bar.set_title(self._escaped_title)
self._header_bar.header_bar.sub_title = self._artist
self.set_visible_child(self._albumWidget)
@log
def update_title(self):
self.header_bar.header_bar.set_title(self._escaped_title)
self.header_bar.header_bar.sub_title = self._artist
self._header_bar.header_bar.set_title(self._escaped_title)
self._header_bar.header_bar.sub_title = self._artist
@log
def populate(self):
self.window.push_loading_notification()
self._window.push_loading_notification()
grilo.populate_albums(self._offset, self._add_item)
@log
def get_selected_tracks(self, callback):
# FIXME: we call into private objects with full knowledge of
# what is there
if self.header_bar._state == ToolbarState.CHILD_VIEW:
if self._header_bar._state == ToolbarState.CHILD_VIEW:
callback(self._albumWidget._disc_listbox.get_selected_items())
else:
self.items_selected = []
......@@ -147,10 +147,10 @@ class AlbumsView(BaseView):
# Add to the flowbox
child = self._create_album_item(item)
self.view.add(child)
self._view.add(child)
elif remaining == 0:
self.window.pop_loading_notification()
self.view.show()
self._window.pop_loading_notification()
self._view.show()
def _create_album_item(self, item):
artist = utils.get_artist_name(item)
......@@ -190,10 +190,7 @@ class AlbumsView(BaseView):
child.add(builder.get_object('main_box'))
child.show()
self.cache.lookup(item,
ArtSize.medium,
self._on_lookup_ready,
child)
self._cache.lookup(item, ArtSize.medium, self._on_lookup_ready, child)
return child
......@@ -238,7 +235,7 @@ class AlbumsView(BaseView):
Selects or unselects all items without sending the notify::active
signal for performance purposes.
"""
for child in self.view.get_children():
for child in self._view.get_children():
GObject.signal_handler_block(child.check, child.check_handler_id)
# Set the checkbutton state without emiting the signal
......
......@@ -64,22 +64,22 @@ class ArtistsView(BaseView):
self._artist_albums_stack.add_named(self._artist_albums_widget,
"sidebar")
self._artist_albums_stack.set_visible_child_name("sidebar")
self.view.set_shadow_type(Gtk.ShadowType.IN)
self.view.get_style_context().add_class('side-panel')
self.view.set_hexpand(False)
self.view.get_generic_view().get_selection().set_mode(
self._view.set_shadow_type(Gtk.ShadowType.IN)
self._view.get_style_context().add_class('side-panel')
self._view.set_hexpand(False)
self._view.get_generic_view().get_selection().set_mode(
Gtk.SelectionMode.SINGLE)
self._grid.attach(self._artist_albums_stack, 2, 0, 2, 2)
self._add_list_renderers()
self.view.get_generic_view().get_style_context().remove_class(
self._view.get_generic_view().get_style_context().remove_class(
'content-view')
self.show_all()
self.view.hide()
self._view.hide()
@log
def _on_changes_pending(self, data=None):
if (self._init
and not self.header_bar._selectionMode):
and not self._header_bar._selectionMode):
self.model.clear()
self._artists.clear()
self._offset = 0
......@@ -100,7 +100,7 @@ class ArtistsView(BaseView):
@log
def _add_list_renderers(self):
list_widget = self.view.get_generic_view()
list_widget = self._view.get_generic_view()
cols = list_widget.get_columns()
cells = cols[0].get_cells()
cells[1].set_visible(False)
......@@ -147,8 +147,8 @@ class ArtistsView(BaseView):
self._artist_albums_stack.add(new_artist_albums_widget)
artist_albums = ArtistAlbumsWidget(artist, albums, self.player,
self.header_bar,
self.selection_toolbar, self.window)
self._header_bar,
self._selection_toolbar, self._window)
self._artists[artist.casefold()]['widget'] = artist_albums
new_artist_albums_widget.add(artist_albums)
new_artist_albums_widget.show()
......@@ -161,9 +161,9 @@ class ArtistsView(BaseView):
@log
def _add_item(self, source, param, item, remaining=0, data=None):
if (not item and remaining == 0):
self.view.set_model(self.model)
self.window.pop_loading_notification()
self.view.show()
self._view.set_model(self.model)
self._window.pop_loading_notification()
self._view.show()
return
self._offset += 1
artist = utils.get_artist_name(item)
......@@ -179,14 +179,14 @@ class ArtistsView(BaseView):
@log
def populate(self):
"""Populates the view"""
self.window.push_loading_notification()
self._window.push_loading_notification()
grilo.populate_artists(self._offset, self._add_item)
@log
def _on_header_bar_toggled(self, button):
BaseView._on_header_bar_toggled(self, button)
view_selection = self.view.get_generic_view().get_selection()
view_selection = self._view.get_generic_view().get_selection()
if button.get_active():
self.text_renderer.set_fixed_size(178, -1)
self._last_selection = view_selection.get_selected()[1]
......@@ -200,8 +200,8 @@ class ArtistsView(BaseView):
@log
def _on_selection_mode_changed(self, widget, data=None):
self._artist_albums_stack.set_sensitive(
not self.header_bar._selectionMode)
if (not self.header_bar._selectionMode
not self._header_bar._selectionMode)
if (not self._header_bar._selectionMode
and grilo.changes_pending['Artists']):
self._on_changes_pending()
......@@ -218,7 +218,7 @@ class ArtistsView(BaseView):
self._albums_index = 0
self._albums_selected = []
for path in self.view.get_selection():
for path in self._view.get_selection():
itr = self.model.get_iter(path)
artist = self.model[itr][2]
albums = self._artists[artist.casefold()]['albums']
......
......@@ -33,24 +33,31 @@ import gnomemusic.utils as utils
class BaseView(Gtk.Stack):
nowPlayingIconName = 'media-playback-start-symbolic'
errorIconName = 'dialog-error-symbolic'
"""Base Class for all view classes"""
_now_playing_icon_name = 'media-playback-start-symbolic'
_error_icon_name = 'dialog-error-symbolic'
selection_mode = GObject.Property(type=bool, default=False)
def __repr__(self):
return '<BaseView>'
@log
def __init__(self, name, title, window, view_type, use_sidebar=False, sidebar=None):
def __init__(self, name, title, window, view_type, use_sidebar=False,
sidebar=None):
"""Initialize
:param name: The view name
:param title: The view title
:param GtkWidget window: The main window
:param view_type: The Gtk view type
:param use_sidebar: Whether to use sidebar
:param sidebar: The sidebar object (Default: Gtk.Box)
"""
Gtk.Stack.__init__(self,
transition_type=Gtk.StackTransitionType.CROSSFADE)
self._grid = Gtk.Grid(orientation=Gtk.Orientation.HORIZONTAL)
self._offset = 0
self._adjustmentValueId = 0
self._adjustmentChangedId = 0
self._scrollbarVisibleId = 0
self.old_vsbl_range = None
self.model = Gtk.ListStore(
GObject.TYPE_STRING,
GObject.TYPE_STRING,
......@@ -65,7 +72,6 @@ class BaseView(Gtk.Stack):
GObject.TYPE_BOOLEAN,
GObject.TYPE_INT
)
self._box = Gtk.Box(orientation=Gtk.Orientation.VERTICAL)
# Setup the main view
......@@ -73,8 +79,7 @@ class BaseView(Gtk.Stack):
if use_sidebar:
self.stack = Gtk.Stack(
transition_type=Gtk.StackTransitionType.SLIDE_RIGHT,
)
transition_type=Gtk.StackTransitionType.SLIDE_RIGHT,)
dummy = Gtk.Frame(visible=False)
self.stack.add_named(dummy, 'dummy')
if sidebar:
......@@ -86,38 +91,31 @@ class BaseView(Gtk.Stack):
if not use_sidebar or sidebar:
self._grid.add(self._box)
self.star_handler = StarHandlerWidget(self, 9)
self._cursor = None
self.window = window
self.header_bar = window.toolbar
self.selection_toolbar = window.selection_toolbar
self.header_bar._select_button.connect(
'toggled', self._on_header_bar_toggled)
self.header_bar._cancel_button.connect(
self._star_handler = StarHandlerWidget(self, 9)
self._window = window
self._header_bar = window.toolbar
self._selection_toolbar = window.selection_toolbar
self._header_bar._select_button.connect(
'toggled', self._on_header_bar_toggled)
self._header_bar._cancel_button.connect(
'clicked', self._on_cancel_button_clicked)
self.name = name
self.title = title
self.add(self._grid)
self.add(self._grid)
self.show_all()
self.view.hide()
self._items = []
self._view.hide()
scale = self.get_scale_factor()
self.cache = AlbumArtCache(scale)
self._cache = AlbumArtCache(scale)
self._loading_icon_surface = DefaultIcon(scale).get(
DefaultIcon.Type.loading,
ArtSize.medium)
DefaultIcon.Type.loading, ArtSize.medium)
self._init = False
grilo.connect('ready', self._on_grilo_ready)
self.selection_socket = None
self.header_bar.connect('selection-mode-changed',
self._on_selection_mode_changed)
self._discovering_urls = {}
self._header_bar.connect('selection-mode-changed',
self._on_selection_mode_changed)
grilo.connect('changes-pending', self._on_changes_pending)
@log
......@@ -126,73 +124,81 @@ class BaseView(Gtk.Stack):
@log
def _setup_view(self, view_type):
self.view = Gd.MainView(shadow_type=Gtk.ShadowType.NONE)
self.view.set_view_type(view_type)
"""Instantiate and set up the view object"""
self._view = Gd.MainView(shadow_type=Gtk.ShadowType.NONE)
self._view.set_view_type(view_type)
self.view.click_handler = self.view.connect('item-activated', self._on_item_activated)
self.view.connect('selection-mode-request', self._on_selection_mode_request)
self._view.click_handler = self._view.connect('item-activated',
self._on_item_activated)
self._view.connect('selection-mode-request',
self._on_selection_mode_request)
self.view.bind_property('selection-mode', self, 'selection_mode',
GObject.BindingFlags.BIDIRECTIONAL)
self._view.bind_property('selection-mode', self, 'selection_mode',
GObject.BindingFlags.BIDIRECTIONAL)
self.view.connect('view-selection-changed', self._on_view_selection_changed)
self._view.connect('view-selection-changed',
self._on_view_selection_changed)
self._box.pack_start(self.view, True, True, 0)
self._box.pack_start(self._view, True, True, 0)
@log
def _on_header_bar_toggled(self, button):
self.selection_mode = button.get_active()
if self.selection_mode:
self.header_bar.set_selection_mode(True)
self._header_bar.set_selection_mode(True)
self.player.actionbar.set_visible(False)
self.selection_toolbar.actionbar.set_visible(True)
self.selection_toolbar._add_to_playlist_button.set_sensitive(False)
self.selection_toolbar._remove_from_playlist_button.set_sensitive(False)
select_toolbar = self._selection_toolbar
select_toolbar.actionbar.set_visible(True)
select_toolbar._add_to_playlist_button.set_sensitive(False)
select_toolbar._remove_from_playlist_button.set_sensitive(False)
else:
self.header_bar.set_selection_mode(False)
self.player.actionbar.set_visible(self.player.currentTrack is not None)
self.selection_toolbar.actionbar.set_visible(False)
self._header_bar.set_selection_mode(False)
track_playing = self.player.currentTrack is not None
self.player.actionbar.set_visible(track_playing)
self._selection_toolbar.actionbar.set_visible(False)
self.unselect_all()
@log
def _on_cancel_button_clicked(self, button):
self.view.set_selection_mode(False)
self.header_bar.set_selection_mode(False)
self._view.set_selection_mode(False)
self._header_bar.set_selection_mode(False)
@log
def _on_grilo_ready(self, data=None):
# FIXME: with async changes in Window this seems never to be
# called anymore. Fix it proper or remove.
if (self.header_bar.get_stack().get_visible_child() == self and not self._init):
if (self._header_bar.get_stack().get_visible_child() == self
and not self._init):
self._populate()
self.header_bar.get_stack().connect('notify::visible-child',
self._on_headerbar_visible)
self._header_bar.get_stack().connect('notify::visible-child',
self._on_headerbar_visible)
@log
def _on_headerbar_visible(self, widget, param):
if self == widget.get_visible_child() and not self._init:
if (self == widget.get_visible_child()
and not self._init):
self._populate()
@log
def _on_view_selection_changed(self, widget):
if not self.selection_mode:
return
items = self.view.get_selection()
items = self._view.get_selection()
self.update_header_from_selection(len(items))
@log
def update_header_from_selection(self, n_items):
self.selection_toolbar._add_to_playlist_button.\
set_sensitive(n_items > 0)
self.selection_toolbar._remove_from_playlist_button.\
set_sensitive(n_items > 0)
"""Updates header during item selection."""
select_toolbar = self._selection_toolbar
select_toolbar._add_to_playlist_button.set_sensitive(n_items > 0)
select_toolbar._remove_from_playlist_button.set_sensitive(n_items > 0)
if n_items > 0:
self.header_bar._selection_menu_label.set_text(
ngettext("Selected %d item", "Selected %d items", n_items) % n_items)
self._header_bar._selection_menu_label.set_text(
ngettext("Selected {} item",
"Selected {} items",
n_items).format(n_items))
else:
self.header_bar._selection_menu_label.set_text(_("Click on items to select them"))
self._header_bar._selection_menu_label.set_text(
_("Click on items to select them"))
@log
def _populate(self, data=None):
......@@ -211,23 +217,21 @@ class BaseView(Gtk.Stack):
def _add_item(self, source, param, item, remaining=0, data=None):
if not item:
if remaining == 0:
self.view.set_model(self.model)
self.window.pop_loading_notification()
self.view.show()
self._view.set_model(self.model)
self._window.pop_loading_notification()
self._view.show()
return
self._offset += 1
artist = utils.get_artist_name(item)
title = utils.get_media_title(item)
_iter = self.model.append(None)
itr = self.model.append(None)
loading_icon = Gdk.pixbuf_get_from_surface(
self._loadin_icon_surface, 0, 0,
self._loading_icon_surface.get_width(),
self._loading_icon_surface.get_height())
self.model[_iter][0, 1, 2, 3, 4, 5, 7, 9] = [
self.model[itr][0, 1, 2, 3, 4, 5, 7, 9] = [
str(item.get_id()),
'',
title,
......@@ -237,17 +241,14 @@ class BaseView(Gtk.Stack):
0,
False
]
self.cache.lookup(item, self._iconWidth, self._iconHeight,
self._on_lookup_ready, _iter)
@log
def _on_lookup_ready(self, surface, _iter):
def _on_lookup_ready(self, surface, itr):
if surface:
pixbuf = Gdk.pixbuf_get_from_surface(surface, 0, 0,
surface.get_width(),
surface.get_height())
self.model[_iter][4] = pixbuf
self.model[itr][4] = pixbuf
@log
def _add_list_renderers(self):
......@@ -259,7 +260,7 @@ class BaseView(Gtk.Stack):
@log
def _on_selection_mode_request(self, *args):
self.header_bar._select_button.clicked()
self._header_bar._select_button.clicked()
@log
def get_selected_tracks(self, callback):
......@@ -268,14 +269,14 @@ class BaseView(Gtk.Stack):
@log
def _set_selection(self, value, parent=None):
count = 0
_iter = self.model.iter_children(parent)
while _iter is not None:
if self.model.iter_has_child(_iter):
count += self._set_selection(value, _iter)
if self.model[_iter][5]:
self.model[_iter][6] = value
itr = self.model.iter_children(parent)
while itr != None:
if self.model.iter_has_child(itr):
count += self._set_selection(value, itr)
if self.model[itr][5] != None:
self.model[itr][6] = value
count += 1
_iter = self.model.iter_next(_iter)
itr = self.model.iter_next(itr)
return count
@log
......@@ -284,17 +285,20 @@ class BaseView(Gtk.Stack):
count = self._set_selection(True)
if count > 0:
self.selection_toolbar._add_to_playlist_button.set_sensitive(True)
self.selection_toolbar._remove_from_playlist_button.set_sensitive(True)
select_toolbar = self._selection_toolbar
select_toolbar._add_to_playlist_button.set_sensitive(True)
select_toolbar._remove_from_playlist_button.set_sensitive(True)
self.update_header_from_selection(count)
self.view.queue_draw()
self._view.queue_draw()
@log
def unselect_all(self):
"""Unselects all the selected tracks."""
self._set_selection(False)
self.selection_toolbar._add_to_playlist_button.set_sensitive(False)
self.selection_toolbar._remove_from_playlist_button.set_sensitive(False)
self.header_bar._selection_menu_label.set_text(_("Click on items to select them"))
select_toolbar = self._selection_toolbar
select_toolbar._add_to_playlist_button.set_sensitive(False)
select_toolbar._remove_from_playlist_button.set_sensitive(False)
self._header_bar._selection_menu_label.set_text(
_("Click on items to select them"))
self.queue_draw()
......@@ -53,11 +53,11 @@ class EmptySearchView(BaseView):
@log
def _back_button_clicked(self, widget, data=None):
self.header_bar.searchbar.show_bar(True, False)
self._header_bar.searchbar.show_bar(True, False)
if self.get_visible_child() == self._artistAlbumsWidget:
self._artistAlbumsWidget.destroy()
self._artistAlbumsWidget = None
elif self.get_visible_child() == self._grid:
self.window.views[0].set_visible_child(self.window.views[0]._grid)
self.window.toolbar.set_state(ToolbarState.CHILD_VIEW)
self._window.views[0].set_visible_child(self._window.views[0]._grid)
self._window.toolbar.set_state(ToolbarState.CHILD_VIEW)
self.set_visible_child(self._grid)
......@@ -51,10 +51,10 @@ class PlaylistView(BaseView):
BaseView.__init__(self, 'playlists', _("Playlists"), window,
Gd.MainViewType.LIST, True, self.playlists_sidebar)
self.view.get_generic_view().get_style_context()\
self._view.get_generic_view().get_style_context()\
.add_class('songs-list')
self._add_list_renderers()
self.view.get_generic_view().get_style_context().remove_class('content-view')
self._view.get_generic_view().get_style_context().remove_class('content-view')
builder = Gtk.Builder()
builder.add_from_resource('/org/gnome/Music/PlaylistControls.ui')
......@@ -123,7 +123,7 @@ class PlaylistView(BaseView):
@log
def _add_list_renderers(self):
list_widget = self.view.get_generic_view()
list_widget = self._view.get_generic_view()
cols = list_widget.get_columns()
cells = cols[0].get_cells()
cells[2].set_visible(False)
......@@ -149,7 +149,7 @@ class PlaylistView(BaseView):
self._on_list_widget_title_render, None)
cols[0].add_attribute(title_renderer, 'text', 2)
self.star_handler.add_star_renderers(list_widget, cols)
self._star_handler.add_star_renderers(list_widget, cols)
duration_renderer = Gd.StyledTextRenderer(
xpad=32,
......@@ -229,10 +229,10 @@ class PlaylistView(BaseView):
return
if model.get_value(_iter, 11) == DiscoveryStatus.FAILED:
cell.set_property('icon-name', self.errorIconName)
cell.set_property('icon-name', self._error_icon_name)
cell.set_visible(True)
elif model.get_value(_iter, 5).get_url() == self.player.currentTrackUri:
cell.set_property('icon-name', self.nowPlayingIconName)
cell.set_property('icon-name', self._now_playing_icon_name)
cell.set_visible(True)
else:
cell.set_visible(False)
......@@ -251,7 +251,7 @@ class PlaylistView(BaseView):
return False
self.model.set_value(currentIter, 10, True)
if self.model.get_value(currentIter, 8) != self.errorIconName:
if self.model[currentIter][8] != self._error_icon_name:
self.iter_to_clean = currentIter.copy()
self.iter_to_clean_model = self.model
......@@ -282,15 +282,15 @@ class PlaylistView(BaseView):
@log
def _on_item_activated(self, widget, id, path):
if self.star_handler.star_renderer_click:
self.star_handler.star_renderer_click = False
if self._star_handler.star_renderer_click:
self._star_handler.star_renderer_click = False
return
try:
_iter = self.model.get_iter(path)
except TypeError:
return
if self.model.get_value(_iter, 8) != self.errorIconName:
if self.model.get_value(_iter, 8) != self._error_icon_name:
self.player.set_playlist(
'Playlist', self.current_playlist.get_id(),
self.model, _iter, 5, 11
......@@ -367,7 +367,7 @@ class PlaylistView(BaseView):
# if the active queue has been set by this playlist,
# use it as model, otherwise build the liststore
self.view.set_model(None)
self._view.set_model(None)
self.model.clear()
self.songs_count = 0
grilo.populate_playlist_songs(playlist, self._add_item)
......@@ -382,7 +382,7 @@ class PlaylistView(BaseView):
def _add_item(self, source, param, item, remaining=0, data=None):
self._add_item_to_model(item, self.model)
if remaining == 0:
self.view.set_model(self.model)
self._view.set_model(self.model)
@log
def _add_item_to_model(self, item, model):
......@@ -410,8 +410,8 @@ class PlaylistView(BaseView):
@log
def _on_selection_mode_changed(self, widget, data=None):
self.playlists_sidebar.set_sensitive(not self.header_bar._selectionMode)
self.menubutton.set_sensitive(not self.header_bar._selectionMode)
self.playlists_sidebar.set_sensitive(not self._header_bar._selectionMode)
self.menubutton.set_sensitive(not self._header_bar._selectionMode)
@log
def _on_play_activate(self, menuitem, data=None):
......@@ -419,9 +419,9 @@ class PlaylistView(BaseView):
if not _iter:
return
self.view.get_generic_view().get_selection().\
self._view.get_generic_view().get_selection().\
select_path(self.model.get_path(_iter))
self.view.emit('item-activated', '0',
self._view.emit('item-activated', '0',
self.model.get_path(_iter))
@log
......@@ -526,4 +526,4 @@ class PlaylistView(BaseView):
@log
def get_selected_tracks(self, callback):
callback([self.model.get_value(self.model.get_iter(path), 5)
for path in self.view.get_selection()])
for path in self._view.get_selection()])
......@@ -81,7 +81,7 @@ class SearchView(BaseView):
self._artists = {}
self._artistAlbumsWidget = None
self.view.get_generic_view().set_show_expanders(False)
self._view.get_generic_view().set_show_expanders(False)
self.items_selected = []
self.items_selected_callback = None
......@@ -89,25 +89,25 @@ class SearchView(BaseView):
@log
def _no_music_found_callback(self, view):
self.window._stack.set_visible_child_name('emptysearch')
emptysearch = self.window._stack.get_child_by_name('emptysearch')
self._window._stack.set_visible_child_name('emptysearch')
emptysearch = self._window._stack.get_child_by_name('emptysearch')
emptysearch._artistAlbumsWidget = self._artistAlbumsWidget
@log
def _back_button_clicked(self, widget, data=None):
self.header_bar.searchbar.show_bar(True, False)
self._header_bar.searchbar.show_bar(True, False)
if self.get_visible_child() == self._artistAlbumsWidget:
self._artistAlbumsWidget.destroy()
self._artistAlbumsWidget = None
elif self.get_visible_child() == self._grid:
self.window