Commit 55daf930 authored by Jean Felder's avatar Jean Felder Committed by Marinus Schraal

playlistsview: Restore playlist_play_action

parent a764a648
......@@ -22,12 +22,14 @@
# code, but you are not obligated to do so. If you do not wish to do so,
# delete this exception statement from your version.
from random import randrange
from gettext import gettext as _
from gi.repository import Gdk, GObject, Gio, Gtk
from gnomemusic import log
from gnomemusic.player import PlayerPlaylist
from gnomemusic.player import PlayerPlaylist, RepeatMode
from gnomemusic.views.baseview import BaseView
from gnomemusic.widgets.notificationspopup import PlaylistNotification
from gnomemusic.widgets.playlistcontextmenu import PlaylistContextMenu
......@@ -84,9 +86,10 @@ class PlaylistsView(BaseView):
'activate', self._stage_song_for_deletion)
# playlist_play_action ='playlist_play', None)
# playlist_play_action.connect('activate', self._on_play_activate)
# self._window.add_action(playlist_play_action)
playlist_play_action ='playlist_play', None)
'activate', self._on_play_playlist)
# self._playlist_delete_action =
# 'playlist_delete', None)
......@@ -179,7 +182,7 @@ class PlaylistsView(BaseView):
selected_row = self._view.get_selected_row()
song_widget = selected_row.get_child()
self._song_activated(song_widget, None)
def _stage_song_for_deletion(self, menuitem, data=None):
......@@ -222,14 +225,27 @@ class PlaylistsView(BaseView):
return song_widget
def _song_activated(self, widget, event):
def _song_activated(self, widget=None, event=None):
# FIXME: Selection should be automatic in the player
if widget is not None:
coresong = widget.props.coresong
position = 0
if self.player.props.repeat_mode == RepeatMode.SHUFFLE:
position = randrange(
0, self._current_playlist.props.model.get_n_items())
coresong = self._current_playlist.props.model.get_item(position)
PlayerPlaylist.Type.PLAYLIST, widget.props.coresong,
PlayerPlaylist.Type.PLAYLIST, coresong,
return True
def _on_play_playlist(self, menuitem, data=None):
def _is_current_playlist(self, playlist):
"""Check if playlist is currently displayed"""
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment