mirror of
https://github.com/kovidgoyal/calibre.git
synced 2025-07-09 03:04:10 -04:00
Allow setting current with ids as well
This commit is contained in:
parent
3155a36b4b
commit
29500738eb
@ -1157,7 +1157,9 @@ class BooksView(QTableView): # {{{
|
|||||||
if self.pin_view.isVisible():
|
if self.pin_view.isVisible():
|
||||||
self.pin_view.horizontalScrollBar().setValue(pv_hpos)
|
self.pin_view.horizontalScrollBar().setValue(pv_hpos)
|
||||||
|
|
||||||
def set_current_row(self, row=0, select=True, for_sync=False):
|
def set_current_row(self, row=0, select=True, for_sync=False, book_id=None):
|
||||||
|
if book_id is not None:
|
||||||
|
row = self.model().db.data.id_to_index(book_id)
|
||||||
if row > -1 and row < self.model().rowCount(QModelIndex()):
|
if row > -1 and row < self.model().rowCount(QModelIndex()):
|
||||||
h = self.horizontalHeader()
|
h = self.horizontalHeader()
|
||||||
logical_indices = list(range(h.count()))
|
logical_indices = list(range(h.count()))
|
||||||
|
Loading…
x
Reference in New Issue
Block a user