summaryrefslogtreecommitdiff
path: root/nephilim/plugins/AlbumCover.py
diff options
context:
space:
mode:
authorAnton Khirnov <wyskas@gmail.com>2009-03-03 07:34:35 +0100
committerAnton Khirnov <wyskas@gmail.com>2009-03-03 07:34:35 +0100
commitc9f59dde4620b4d02b18cf1fcfaded0d22f77b6e (patch)
treea75feff375e60c5f6caf43cd62dfaf515df54d89 /nephilim/plugins/AlbumCover.py
parent9a17c88423696aeda50a9418ed022d7e85f8e36b (diff)
AlbumCover: allow saving covers to arbitrary files.
Diffstat (limited to 'nephilim/plugins/AlbumCover.py')
-rw-r--r--nephilim/plugins/AlbumCover.py16
1 files changed, 14 insertions, 2 deletions
diff --git a/nephilim/plugins/AlbumCover.py b/nephilim/plugins/AlbumCover.py
index b8b5c79..ee51903 100644
--- a/nephilim/plugins/AlbumCover.py
+++ b/nephilim/plugins/AlbumCover.py
@@ -28,12 +28,14 @@ class wgAlbumCover(QtGui.QLabel):
# popup menu
self.menu = QtGui.QMenu("album")
select_file_action = self.menu.addAction('&Select cover file...')
- fetch_amazon_action = self.menu.addAction('Fetch cover from &Amazon.')
- view_action = self.menu.addAction('&View cover in a separate window.')
+ fetch_amazon_action = self.menu.addAction('Fetch from &Amazon.')
+ view_action = self.menu.addAction('&View in a separate window.')
+ save_action = self.menu.addAction('Save &as...')
self.connect(select_file_action, QtCore.SIGNAL('triggered()'), self.fetch_local_manual)
self.connect(fetch_amazon_action, QtCore.SIGNAL('triggered()'), self.fetch_amazon_manual)
self.connect(view_action, QtCore.SIGNAL('triggered()'), self.view_cover)
+ self.connect(save_action, QtCore.SIGNAL('triggered()'), self.save_cover)
def mousePressEvent(self, event):
if event.button() == QtCore.Qt.RightButton:
@@ -184,6 +186,16 @@ class wgAlbumCover(QtGui.QLabel):
win.setPixmap(self.cover)
win.show()
+ def save_cover(self):
+ if not self.cover_loaded:
+ return
+
+ cover = self.cover
+ file = QtGui.QFileDialog.getSaveFileName(None, '', os.path.expanduser('~'))
+ if file:
+ if not cover.save(file):
+ logging.error('Saving cover failed.')
+
class AlbumCover(Plugin):
o = None
DEFAULTS = {'coverdir' : '$musicdir/$songdir', 'covername' : '.cover_nephilim_$artist_$album',