mirror of
https://github.com/kovidgoyal/calibre.git
synced 2025-07-09 03:04:10 -04:00
Fix first book not being selected on calibre startup
This commit is contained in:
parent
50c6ff97d4
commit
ea37f4e8a7
@ -7,8 +7,8 @@ __docformat__ = 'restructuredtext en'
|
||||
|
||||
import functools
|
||||
|
||||
from PyQt4.Qt import Qt, QStackedWidget, QMenu, \
|
||||
QSize, QSizePolicy, QStatusBar, QLabel, QFont
|
||||
from PyQt4.Qt import (Qt, QStackedWidget, QMenu, QTimer,
|
||||
QSize, QSizePolicy, QStatusBar, QLabel, QFont)
|
||||
|
||||
from calibre.utils.config import prefs
|
||||
from calibre.constants import (isosx, __appname__, preferred_encoding,
|
||||
@ -274,7 +274,7 @@ class LayoutMixin(object): # {{{
|
||||
|
||||
m = self.library_view.model()
|
||||
if m.rowCount(None) > 0:
|
||||
self.library_view.set_current_row(0)
|
||||
QTimer.singleShot(0, self.library_view.set_current_row)
|
||||
m.current_changed(self.library_view.currentIndex(),
|
||||
self.library_view.currentIndex())
|
||||
self.library_view.setFocus(Qt.OtherFocusReason)
|
||||
|
@ -777,7 +777,7 @@ class BooksView(QTableView): # {{{
|
||||
self.scrollTo(self.model().index(row, i), self.PositionAtCenter)
|
||||
break
|
||||
|
||||
def set_current_row(self, row, select=True):
|
||||
def set_current_row(self, row=0, select=True):
|
||||
if row > -1 and row < self.model().rowCount(QModelIndex()):
|
||||
h = self.horizontalHeader()
|
||||
logical_indices = list(range(h.count()))
|
||||
|
Loading…
x
Reference in New Issue
Block a user