mirror of
https://github.com/kovidgoyal/calibre.git
synced 2025-07-09 03:04:10 -04:00
Fix deletion
This commit is contained in:
parent
fb59a6b28c
commit
93a1a15533
@ -100,20 +100,12 @@ class BooksModel(QAbstractTableModel):
|
|||||||
''' Return list indices of all cells in index.row()'''
|
''' Return list indices of all cells in index.row()'''
|
||||||
return [ self.index(index.row(), c) for c in range(self.columnCount(None))]
|
return [ self.index(index.row(), c) for c in range(self.columnCount(None))]
|
||||||
|
|
||||||
def removeRows(self, row, count, parent=QModelIndex()):
|
|
||||||
rows = [row + i for i in range(count)]
|
|
||||||
self.beginRemoveRows(parent, row, row+count-1)
|
|
||||||
self.db.delete_books(rows)
|
|
||||||
self.endRemoveRows()
|
|
||||||
|
|
||||||
def removeRow(self, row, parent=QModelIndex()):
|
|
||||||
self.removeRows(row, 1)
|
|
||||||
|
|
||||||
def delete_books(self, indices):
|
def delete_books(self, indices):
|
||||||
rows = [ i.row() for i in indices ]
|
rows = [ i.row() for i in indices ]
|
||||||
for row in rows:
|
for row in rows:
|
||||||
self.removeRow(row)
|
self.beginRemoveRows(QModelIndex(), row, row)
|
||||||
self.emit(SIGNAL('layoutChanged()'))
|
self.db.delete_books(rows)
|
||||||
|
self.endRemoveRows()
|
||||||
self.emit(SIGNAL('deleted()'))
|
self.emit(SIGNAL('deleted()'))
|
||||||
|
|
||||||
def search_tokens(self, text):
|
def search_tokens(self, text):
|
||||||
|
Loading…
x
Reference in New Issue
Block a user