Port the deleted songs invalidator script to PythonQt. Thanks schizosfera. Fixes issue 2035
This commit is contained in:
parent
55b001c400
commit
5dbdc8354b
|
@ -1,8 +1,7 @@
|
||||||
import clementine
|
import clementine
|
||||||
|
|
||||||
from PyQt4.QtCore import QObject
|
from PythonQt.QtCore import QObject
|
||||||
from PyQt4.QtCore import SIGNAL
|
from PythonQt.QtGui import QAction
|
||||||
from PyQt4.QtGui import QAction
|
|
||||||
|
|
||||||
|
|
||||||
class InvalidateDeleted(QObject):
|
class InvalidateDeleted(QObject):
|
||||||
|
@ -17,11 +16,11 @@ class InvalidateDeleted(QObject):
|
||||||
|
|
||||||
self.invalidate = QAction("invalidate_deleted", self)
|
self.invalidate = QAction("invalidate_deleted", self)
|
||||||
self.invalidate.setText("Grey out deleted songs")
|
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 = QAction("remove_deleted", self)
|
||||||
self.delete.setText("Remove deleted songs")
|
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.invalidate)
|
||||||
clementine.ui.AddAction('playlist_menu', self.delete)
|
clementine.ui.AddAction('playlist_menu', self.delete)
|
||||||
|
|
|
@ -1298,7 +1298,7 @@ bool Playlist::removeRows(QList<int>& rows) {
|
||||||
// we're splitting the input list into sequences of consecutive
|
// we're splitting the input list into sequences of consecutive
|
||||||
// numbers
|
// numbers
|
||||||
part.append(rows.takeFirst());
|
part.append(rows.takeFirst());
|
||||||
while(rows.first() == part.last() - 1) {
|
while(!rows.isEmpty() && rows.first() == part.last() - 1) {
|
||||||
part.append(rows.takeFirst());
|
part.append(rows.takeFirst());
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue