def update(self, item): """Update the album widget. :param item: The grilo media item """ # reset view self._songs = [] self._create_model() for widget in self._disc_listbox.get_children(): self._disc_listbox.remove(widget) self._duration = 0 art = ArtImage(Art.Size.LARGE, item) art.image = self._cover GLib.idle_add(grilo.populate_album_songs, item, self.add_item) self._album = utils.get_album_title(item) self._artist_label.props.label = utils.get_artist_name(item) self._title_label.props.label = self._album year = utils.get_media_year(item) if not year: year = '----' self._released_info_label.props.label = year self._set_composer_label(item) self._player.connect('song-changed', self._update_model)
def update(self, album): """Update the album widget. :param Grl.Media album: The grilo media album """ # reset view self._songs = [] self._create_model() for widget in self._disc_listbox.get_children(): self._disc_listbox.remove(widget) self._cover_stack.update(album) self._duration = 0 self._album_name = utils.get_album_title(album) artist = utils.get_artist_name(album) self._title_label.props.label = self._album_name self._title_label.props.tooltip_text = self._album_name self._artist_label.props.label = artist self._artist_label.props.tooltip_text = artist year = utils.get_media_year(album) if not year: year = '----' self._released_info_label.props.label = year self._set_composer_label(album) self._player.connect('song-changed', self._update_model) grilo.populate_album_songs(album, self.add_item)
def update(self, media): """Update the CoreAlbum object with new info :param Grl.Media media: A media object """ self.props.media = media self.props.artist = utils.get_artist_name(media) self.props.composer = media.get_composer() self.props.title = utils.get_media_title(media) self.props.year = utils.get_media_year(media)
def __init__(self, media, player, model, header_bar, selection_mode_allowed, size_group=None, cover_size_group=None): super().__init__(orientation=Gtk.Orientation.HORIZONTAL) self._size_group = size_group self._cover_size_group = cover_size_group self._media = media self._player = player self._artist = utils.get_artist_name(self._media) self._album_title = utils.get_album_title(self._media) self._model = model self._header_bar = header_bar self._selection_mode = False self._selection_mode_allowed = selection_mode_allowed self._songs = [] self._cover_stack.props.size = Art.Size.MEDIUM self._cover_stack.update(self._media) allowed = self._selection_mode_allowed self._disc_list_box.props.selection_mode_allowed = allowed self.bind_property( 'selection-mode', self._disc_list_box, 'selection-mode', GObject.BindingFlags.BIDIRECTIONAL | GObject.BindingFlags.SYNC_CREATE) self._title.props.label = self._album_title year = utils.get_media_year(self._media) if year: self._year.props.label = year if self._size_group: self._size_group.add_widget(self._album_box) if self._cover_size_group: self._cover_size_group.add_widget(self._cover_stack) grilo.populate_album_songs(self._media, self._add_item)
def update(self, album): """Update the album widget. :param Grl.Media album: The grilo media album """ # reset view self._songs = [] self._create_model() for widget in self._disc_listbox.get_children(): self._disc_listbox.remove(widget) self._cover_stack.update(album) self._duration = 0 self._album_name = utils.get_album_title(album) artist = utils.get_artist_name(album) self._title_label.props.label = self._album_name self._title_label.props.tooltip_text = self._album_name self._artist_label.props.label = artist self._artist_label.props.tooltip_text = artist year = utils.get_media_year(album) if not year: year = '----' self._released_info_label.props.label = year self._set_composer_label(album) self._album = album self._player.connect('song-changed', self._update_model) grilo.populate_album_songs(album, self.add_item)
def update(self, media): self.props.media = media self.props.artist = utils.get_artist_name(media) self.props.composer = media.get_composer() self.props.title = utils.get_media_title(media) self.props.year = utils.get_media_year(media)