QML: Click on album shows the alternatives and saves them
[mussorgsky] / src / qml / albumItem.py
1 # -*- coding: utf-8 -*-
2 import os
3 import sys
4 from PySide import QtCore
5 from PySide import QtGui
6 from PySide import QtDeclarative
7
8
9 class AlbumItem (QtCore.QObject):
10
11     def __init__ (self, title, artist, album_art):
12         QtCore.QObject.__init__(self)
13         self._title = title
14         self._artist = artist
15         self._album_art = album_art
16
17     def _title (self):
18         return self._title
19
20     def _artist (self):
21         return self._artist
22
23     def _albumArt (self):
24         return self._album_art
25
26     def _setAlbumArt (self, path):
27         print "Setting the new album art to", path
28         self._album_art = path
29         self.album_art_changed.emit ()
30     
31     prop_changed = QtCore.Signal ()
32     album_art_changed = QtCore.Signal ()
33
34     title = QtCore.Property (unicode, _title, notify=prop_changed)
35     artist = QtCore.Property (unicode, _artist, notify=prop_changed)
36     album_art = QtCore.Property (unicode,
37                                  _albumArt,
38                                  _setAlbumArt,
39                                  notify=album_art_changed)
40