Port the deleted songs invalidator script to PythonQt. Thanks schizosfera. Fixes issue 2035

This commit is contained in:
David Sansome 2011-07-01 20:47:46 +00:00
parent 55b001c400
commit 5dbdc8354b
2 changed files with 6 additions and 7 deletions

View File

@ -1,8 +1,7 @@
import clementine
from PyQt4.QtCore import QObject
from PyQt4.QtCore import SIGNAL
from PyQt4.QtGui import QAction
from PythonQt.QtCore import QObject
from PythonQt.QtGui import QAction
class InvalidateDeleted(QObject):
@ -17,11 +16,11 @@ class InvalidateDeleted(QObject):
self.invalidate = QAction("invalidate_deleted", self)
self.invalidate.setText("Grey out deleted songs")
self.connect(self.invalidate, SIGNAL("activated()"), self.grey_out_activated)
self.invalidate.connect("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)
self.delete.connect("activated()", self.delete_activated)
clementine.ui.AddAction('playlist_menu', self.invalidate)
clementine.ui.AddAction('playlist_menu', self.delete)

View File

@ -1298,7 +1298,7 @@ bool Playlist::removeRows(QList<int>& rows) {
// we're splitting the input list into sequences of consecutive
// numbers
part.append(rows.takeFirst());
while(rows.first() == part.last() - 1) {
while(!rows.isEmpty() && rows.first() == part.last() - 1) {
part.append(rows.takeFirst());
}