Ejemplo n.º 1
0
 def _on_new_playlist_activate(self, item, songs):
     parent = get_menu_item_top_parent(item)
     title = Playlist.suggested_name_for(songs)
     title = GetPlaylistName(qltk.get_top_parent(parent)).run(title)
     if title is None:
         return
     playlist = FileBackedPlaylist.new(PLAYLISTS, title)
     playlist.extend(songs)
     PlaylistsBrowser.changed(playlist)
Ejemplo n.º 2
0
 def _on_new_playlist_activate(self, item, songs):
     parent = get_menu_item_top_parent(item)
     title = Playlist.suggested_name_for(songs)
     title = GetPlaylistName(qltk.get_top_parent(parent)).run(title)
     if title is None:
         return
     playlist = FileBackedPlaylist.new(PLAYLISTS, title)
     playlist.extend(songs)
     PlaylistsBrowser.changed(playlist)
Ejemplo n.º 3
0
 def __toggle_playlist(playlist, songs, parent):
     has_some, has_all = playlist.has_songs(songs)
     if has_all:
         playlist.remove_songs(songs)
     elif has_some:
         resp = ConfirmMultipleSongsAction(parent, playlist, songs).run()
         if resp == ConfirmMultipleSongsAction.REMOVE:
             playlist.remove_songs(songs)
         elif resp == ConfirmMultipleSongsAction.ADD:
             playlist.extend(songs)
         return
     else:
         playlist.extend(songs)
     PlaylistsBrowser.changed(playlist)
Ejemplo n.º 4
0
    def _on_toggle_playlist_activate(self, item, playlist, songs):
        parent = get_menu_item_top_parent(item)

        has_some, has_all = playlist.has_songs(songs)
        if has_all:
            playlist.remove_songs(songs)
        elif has_some:
            resp = ConfirmMultipleSongsAction(parent, playlist, songs).run()
            if resp == ConfirmMultipleSongsAction.REMOVE:
                playlist.remove_songs(songs)
            elif resp == ConfirmMultipleSongsAction.ADD:
                playlist.extend(songs)
            return
        else:
            playlist.extend(songs)
        PlaylistsBrowser.changed(playlist)
Ejemplo n.º 5
0
    def _on_toggle_playlist_activate(self, item, playlist, songs):
        parent = get_menu_item_top_parent(item)

        has_some, has_all = playlist.has_songs(songs)
        if has_all:
            playlist.remove_songs(songs)
        elif has_some:
            resp = ConfirmMultipleSongsAction(parent, playlist, songs).run()
            if resp == ConfirmMultipleSongsAction.REMOVE:
                playlist.remove_songs(songs)
            elif resp == ConfirmMultipleSongsAction.ADD:
                playlist.extend(songs)
            return
        else:
            playlist.extend(songs)
        PlaylistsBrowser.changed(playlist)
Ejemplo n.º 6
0
    def _on_new_playlist_activate(self, item, songs):
        parent = get_menu_item_top_parent(item)

        if len(songs) == 1:
            title = songs[0].comma("title")
        else:
            title = ngettext("%(title)s and %(count)d more",
                             "%(title)s and %(count)d more",
                             len(songs) - 1) % {
                                 'title': songs[0].comma("title"),
                                 'count': len(songs) - 1
                             }
        title = GetPlaylistName(qltk.get_top_parent(parent)).run(title)
        if title is None:
            return
        playlist = Playlist.new(PLAYLISTS, title)
        playlist.extend(songs)
        PlaylistsBrowser.changed(playlist)
Ejemplo n.º 7
0
    def _on_new_playlist_activate(self, item, songs):
        parent = get_menu_item_top_parent(item)

        if len(songs) == 1:
            title = songs[0].comma("title")
        else:
            title = ngettext(
                "%(title)s and %(count)d more",
                "%(title)s and %(count)d more",
                len(songs) - 1) % {
                    'title': songs[0].comma("title"),
                    'count': len(songs) - 1
                }
        title = GetPlaylistName(qltk.get_top_parent(parent)).run(title)
        if title is None:
            return
        playlist = Playlist.new(PLAYLISTS, title)
        playlist.extend(songs)
        PlaylistsBrowser.changed(playlist)
Ejemplo n.º 8
0
 def on_new(widget, playlist):
     PlaylistsBrowser.changed(playlist)
Ejemplo n.º 9
0
 def on_new(widget, playlist):
     PlaylistsBrowser.changed(playlist)
Ejemplo n.º 10
0
 def __add_songs_to_playlist(playlist, songs):
     playlist.extend(songs)
     PlaylistsBrowser.changed(playlist)