2011-03-19 11:22:55 +01:00
|
|
|
import clementine
|
|
|
|
|
|
|
|
from PyQt4.QtCore import QObject
|
|
|
|
from PyQt4.QtCore import SIGNAL
|
|
|
|
from PyQt4.QtGui import QAction
|
|
|
|
|
2011-04-21 23:56:37 +02:00
|
|
|
|
2011-03-19 11:22:55 +01:00
|
|
|
class InvalidateDeleted(QObject):
|
2011-04-21 23:56:37 +02:00
|
|
|
"""
|
|
|
|
TODO: actions which are defined here should be implemented here too instead of delegating
|
|
|
|
the responsibility to Playlist Manager. Unfortunately, it cannot be done at this moment
|
|
|
|
since using PlaylistItemPtrs in Python crashes Clementine.
|
|
|
|
"""
|
2011-03-19 11:22:55 +01:00
|
|
|
|
|
|
|
def __init__(self):
|
|
|
|
QObject.__init__(self)
|
|
|
|
|
2011-04-21 23:56:37 +02:00
|
|
|
self.invalidate = QAction("invalidate_deleted", self)
|
|
|
|
self.invalidate.setText("Grey out deleted songs")
|
|
|
|
self.connect(self.invalidate, SIGNAL("activated()"), self.grey_out_activated)
|
|
|
|
|
|
|
|
self.delete = QAction("remove_deleted", self)
|
|
|
|
self.delete.setText("Remove deleted songs")
|
|
|
|
self.connect(self.delete, SIGNAL("activated()"), self.delete_activated)
|
2011-03-19 11:22:55 +01:00
|
|
|
|
2011-04-21 23:56:37 +02:00
|
|
|
clementine.ui.AddAction('playlist_menu', self.invalidate)
|
|
|
|
clementine.ui.AddAction('playlist_menu', self.delete)
|
2011-03-19 11:22:55 +01:00
|
|
|
|
|
|
|
def grey_out_activated(self):
|
|
|
|
clementine.playlists.InvalidateDeletedSongs()
|
2011-04-21 23:56:37 +02:00
|
|
|
|
|
|
|
def delete_activated(self):
|
|
|
|
clementine.playlists.RemoveDeletedSongs()
|
2011-03-19 11:22:55 +01:00
|
|
|
|
|
|
|
|
|
|
|
script = InvalidateDeleted()
|