def _on_destroy(self, widget):
     """
         Destroyed widget
         @param widget as Gtk.Widget
     """
     if self._view_type & ViewType.DND:
         DNDRow._on_destroy(self, widget)
 def __init__(self, album, height, view_type, reveal, cover_uri, parent):
     """
         Init row widgets
         @param album as Album
         @param height as int
         @param view_type as ViewType
         @param reveal as bool
         @param parent as AlbumListView
     """
     Gtk.ListBoxRow.__init__(self)
     TracksView.__init__(self, view_type)
     if view_type & ViewType.DND:
         DNDRow.__init__(self)
     self.__next_row = None
     self.__previous_row = None
     self.__revealer = None
     self.__parent = parent
     self.__reveal = reveal
     self.__cover_uri = cover_uri
     self._artwork = None
     self._album = album
     self.__view_type = view_type
     self.__cancellable = Gio.Cancellable()
     self.set_sensitive(False)
     self.set_property("height-request", height)
     self.connect("destroy", self.__on_destroy)
Example #3
0
 def set_previous_row(self, row):
     """
         Set previous row
         @param row as Row
     """
     DNDRow.set_previous_row(self, row)
     self.update_artwork_state()
 def __init__(self, album, height, list_type, reveal, parent):
     """
         Init row widgets
         @param album as Album
         @param height as int
         @param list_type as RowListType
         @param reveal as bool
         @param parent as AlbumListView
     """
     Gtk.ListBoxRow.__init__(self)
     TracksView.__init__(self, list_type)
     if list_type & RowListType.DND:
         DNDRow.__init__(self)
     self.__revealer = None
     self.__parent = parent
     self.__reveal = reveal
     self._artwork = None
     self._album = album
     self.__list_type = list_type
     self.__play_indicator = None
     self.set_sensitive(False)
     self.set_property("height-request", height)
     # 15 for scrollbar overlay
     self.set_margin_end(15)
     self.connect("destroy", self.__on_destroy)
Example #5
0
 def _on_destroy(self, widget):
     """
         Destroyed widget
         @param widget as Gtk.Widget
     """
     Row._on_destroy(self, widget)
     if self._list_type & RowListType.DND:
         DNDRow._on_destroy(self, widget)
Example #6
0
 def __on_button_clicked(self, button):
     """
         Remove rows
         @param button as Gtk.ModelButton
     """
     from lollypop.widgets_row_dnd import DNDRow
     for r in self.__rows:
         DNDRow.destroy_track_row(r)
Example #7
0
 def _on_destroy(self, widget):
     """
         Destroyed widget
         @param widget as Gtk.Widget
     """
     Row._on_destroy(self, widget)
     DNDRow._on_destroy(self, widget)
     self.__artwork = None
Example #8
0
 def __on_key_press_event(self, widget, event):
     """
         Handle keyboard events (DEL, ...)
         @param widget as Gtk.Widget
         @param event as Gdk.EventKey
     """
     if event.keyval == Gdk.KEY_Delete:
         from lollypop.widgets_row_dnd import DNDRow
         for child in self.children:
             if child.get_state_flags() & Gtk.StateFlags.SELECTED:
                 DNDRow.destroy_track_row(child)
Example #9
0
 def __init__(self, track, list_type):
     """
         Init row widget
         @param track as Track
         @param list_type as RowListType
     """
     Row.__init__(self, track, list_type)
     if list_type & RowListType.DND:
         DNDRow.__init__(self)
     self.__filtered = False
     self._grid.insert_row(0)
     self._grid.insert_column(0)
     self._grid.insert_column(1)
     self._grid.attach(self._indicator, 1, 1, 1, 2)
     self.__artwork = App().art_helper.get_image(ArtSize.MEDIUM,
                                                 ArtSize.MEDIUM,
                                                 "small-cover-frame")
     self.__artwork.set_no_show_all(True)
     self.__artwork.set_margin_top(2)
     self.__artwork.set_margin_start(2)
     self.__artwork.set_margin_bottom(2)
     # We force width with a Box
     box = Gtk.Box()
     box.set_homogeneous(True)
     box.add(self.__artwork)
     box.set_property("width-request", ArtSize.MEDIUM + 2)
     self._grid.attach(box, 0, 0, 1, 2)
     self.show_all()
     self.__header = Gtk.Grid()
     self.__header.set_column_spacing(5)
     if self._track.album.artist_ids[0] != Type.COMPILATIONS:
         self.__album_artist_label = Gtk.Label()
         self.__album_artist_label.set_markup(
             "<b>" +
             GLib.markup_escape_text(", ".join(self._track.album.artists)) +
             "</b>")
         self.__album_artist_label.set_ellipsize(Pango.EllipsizeMode.END)
         self.__album_artist_label.get_style_context().add_class(
             "dim-label")
         self.__header.add(self.__album_artist_label)
     self.__album_label = Gtk.Label.new(self._track.album.name)
     self.__album_label.set_ellipsize(Pango.EllipsizeMode.END)
     self.__album_label.get_style_context().add_class("dim-label")
     self.__album_label.set_hexpand(True)
     self.__album_label.set_property("halign", Gtk.Align.END)
     self.__header.add(self.__album_label)
     if self._artists_label is not None:
         self._grid.attach(self.__header, 1, 0, 5, 1)
     else:
         self._grid.attach(self.__header, 1, 0, 4, 1)
     self.set_indicator(App().player.current_track.id == self._track.id,
                        self._track.loved)
Example #10
0
 def __init__(self, track, list_type):
     """
         Init row widget and show it
         @param track as Track
         @param list_type as RowListType
     """
     Row.__init__(self, track, list_type)
     self.__filtered = False
     self._grid.insert_column(0)
     self._grid.attach(self._indicator, 0, 0, 1, 1)
     self.show_all()
     if list_type & RowListType.DND:
         DNDRow.__init__(self)
 def __init__(self, track, album_artist_ids, view_type):
     """
         Init row widget and show it
         @param track as Track
         @pram album_artist_ids as [int]
         @param view_type as ViewType
     """
     Row.__init__(self, track, album_artist_ids, view_type)
     self._grid.insert_column(0)
     self._grid.attach(self._indicator, 0, 0, 1, 1)
     self.show_all()
     if view_type & ViewType.DND:
         DNDRow.__init__(self)