def _on_row_activated(self, widget, row): """ Play searched item when selected @param widget as Gtk.ListBox @param row as SearchRow """ if Lp().player.is_party() or Lp().player.locked or Lp().player.queued: if row.is_track(): if Lp().player.locked or Lp().player.queued: if row.get_id() in Lp().player.get_queue(): Lp().player.del_from_queue(row.get_id()) else: Lp().player.append_to_queue(row.get_id()) row.destroy() else: Lp().player.load(Track(row.get_id())) elif Gtk.get_minor_version() > 16: popover = AlbumPopover(row.get_id(), [], []) popover.set_relative_to(row) popover.show() else: t = Thread(target=self._play_search, args=(row.get_id(), row.is_track())) t.daemon = True t.start() else: t = Thread(target=self._play_search, args=(row.get_id(), row.is_track())) t.daemon = True t.start()
def __on_row_activated(self, widget, row): """ Play searched item when selected @param widget as Gtk.ListBox @param row as AlbumRow """ genre_ids = Lp().player.get_genre_ids(row.id) artist_ids = Lp().player.get_artist_ids(row.id) # TODO Remove this later if Gtk.get_minor_version() > 16: popover = AlbumPopover(row.id, genre_ids, []) popover.set_relative_to(row) popover.show() else: album = Album(row.id, genre_ids, artist_ids) Lp().player.load(album.tracks[0])
def __on_album_activated(self, flowbox, album_widget): """ Show Context view for activated album @param flowbox as Gtk.Flowbox @param album_widget as AlbumSimpleWidget """ # Here some code for touch screens # If mouse pointer activate Gtk.FlowBoxChild, overlay is on, # as enter notify event enabled it # Else, we are in touch screen, first time show overlay, next time # show popover if not album_widget.is_overlay: album_widget.show_overlay(True) return cover = album_widget.get_cover() if cover is None: return # If widget top not on screen, popover will fail to show # FIXME: Report a bug and check always true (x, y) = album_widget.translate_coordinates(self._scrolled, 0, 0) if y < 0: y = album_widget.translate_coordinates(self._box, 0, 0)[1] self._scrolled.get_allocation().height + y self._scrolled.get_vadjustment().set_value(y) allocation = self.get_allocation() (x, top_height) = album_widget.translate_coordinates(self, 0, 0) bottom_height = allocation.height -\ album_widget.get_allocation().height -\ top_height if bottom_height > top_height: height = bottom_height else: height = top_height popover = AlbumPopover(album_widget.id, self.__genre_ids, self.__artist_ids, allocation.width, height, ArtSize.NONE) popover.set_relative_to(cover) popover.set_position(Gtk.PositionType.BOTTOM) album_widget.show_overlay(False) album_widget.lock_overlay(True) popover.connect("closed", self.__on_album_popover_closed, album_widget) popover.show() self.__current = album_widget cover.set_opacity(0.9)
def _on_album_activated(self, flowbox, album_widget): """ Show Context view for activated album @param flowbox as Gtk.Flowbox @param album_widget as AlbumSimpleWidget """ cover = album_widget.get_cover() if cover is None: return # If widget top not on screen, popover will fail to show # FIXME: Report a bug and check always true (x, y) = album_widget.translate_coordinates(self._scrolled, 0, 0) if y < 0: y = album_widget.translate_coordinates(self._albumbox, 0, 0)[1] self._scrolled.get_allocation().height + y self._scrolled.get_vadjustment().set_value(y) if self._press_rect is not None: pop_menu = AlbumMenu(Album(album_widget.get_id())) popover = Gtk.Popover.new_from_model(cover, pop_menu) popover.set_position(Gtk.PositionType.BOTTOM) popover.set_pointing_to(self._press_rect) else: allocation = self.get_allocation() (x, top_height) = album_widget.translate_coordinates(self, 0, 0) bottom_height = allocation.height -\ album_widget.get_allocation().height -\ top_height if bottom_height > top_height: height = bottom_height else: height = top_height popover = AlbumPopover(album_widget.get_id(), self._genre_ids, self._artist_ids, allocation.width, height, False) popover.set_relative_to(cover) popover.set_position(Gtk.PositionType.BOTTOM) album_widget.show_overlay(False) album_widget.lock_overlay(True) popover.connect('closed', self._on_popover_closed, album_widget) popover.show() cover.set_opacity(0.9)
def _on_row_activated(self, widget, row): """ Play searched item when selected @param widget as Gtk.ListBox @param row as AlbumRow """ genre_ids = Lp().player.get_genre_ids(row.get_id()) artist_ids = Lp().player.get_artist_ids(row.get_id()) # TODO Remove this later if Gtk.get_minor_version() > 16: popover = AlbumPopover( row.get_id(), genre_ids, []) popover.set_relative_to(row) popover.show() else: album = Album(row.get_id(), genre_ids, artist_ids) Lp().player.load(album.tracks[0])
def __on_row_activated(self, widget, row): """ Play searched item when selected @param widget as Gtk.ListBox @param row as SearchRow """ if Lp().player.is_party or Lp().player.locked: # External track/album if row.id is None: pass elif row.is_track: if Lp().player.locked: if row.id in Lp().player.get_queue(): Lp().player.del_from_queue(row.id) else: Lp().player.append_to_queue(row.id) row.destroy() else: Lp().player.load(Track(row.id)) elif Gtk.get_minor_version() > 16: popover = AlbumPopover(row.id, [], []) popover.set_relative_to(row) popover.show() else: t = Thread(target=self.__play_search, args=(row.id, row.is_track)) t.daemon = True t.start() else: if row.id is None: row.play() else: t = Thread(target=self.__play_search, args=(row.id, row.is_track)) t.daemon = True t.start()