From ac228ba641b170ec71b207c0e8de3a1eb6dada2e Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Luk=C3=A1=C5=A1=20Lalinsk=C3=BD?= Date: Tue, 5 Sep 2006 23:01:50 +0200 Subject: [PATCH] Moving matched files from album to cluster. --- picard/ui/itemviews.py | 16 ++++++++++++++++ 1 file changed, 16 insertions(+) diff --git a/picard/ui/itemviews.py b/picard/ui/itemviews.py index 6817e2ecb..c8bc82f73 100644 --- a/picard/ui/itemviews.py +++ b/picard/ui/itemviews.py @@ -145,6 +145,15 @@ class BaseTreeView(QtGui.QTreeWidget): for file in files: target.matchFile(file) + def dropAlbums(self, albums, target): + # Album -> Cluster + if isinstance(target, Cluster): + for album in albums: + for track in album.tracks: + if track.isLinked(): + file = track.getLinkedFile() + file.moveToCluster(target) + def dropUrls(self, urls, target): # URL -> Unmatched Files # TODO: use the drop target to move files to specific albums/tracks/clusters @@ -182,6 +191,13 @@ class BaseTreeView(QtGui.QTreeWidget): files = [self.tagger.fileManager.getFile(int(fileId)) for fileId in str(files).split("\n")] self.dropFiles(files, target) + # application/picard.album-list + albums = data.data("application/picard.album-list") + if albums: + albums = [self.tagger.albumManager.getAlbumById(albumsId) for albumsId in str(albums).split("\n")] + print albums + self.dropAlbums(albums, target) + return True class FileTreeView(BaseTreeView):