示例#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)
示例#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)
示例#3
0
文件: menu.py 项目: ch1huizong/scode
 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)
示例#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)
示例#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)
示例#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)
示例#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)
示例#8
0
 def on_new(widget, playlist):
     PlaylistsBrowser.changed(playlist)
示例#9
0
 def on_new(widget, playlist):
     PlaylistsBrowser.changed(playlist)
示例#10
0
文件: menu.py 项目: ch1huizong/scode
 def __add_songs_to_playlist(playlist, songs):
     playlist.extend(songs)
     PlaylistsBrowser.changed(playlist)