Fix a regression that caused an error when starting calibre with an empty virtual library pre-selected

Merge branch 'master' of https://github.com/cbhaley/calibre
This commit is contained in:
Kovid Goyal 2017-07-08 08:36:28 +05:30
commit 90cfbc5229
No known key found for this signature in database
GPG Key ID: 06BC317B515ACE7C

View File

@ -218,6 +218,7 @@ class Quickview(QDialog, Ui_Quickview):
self.books_table.horizontalHeader().sectionResized.connect(self.section_resized) self.books_table.horizontalHeader().sectionResized.connect(self.section_resized)
self.dock_button.clicked.connect(self.show_as_pane_changed) self.dock_button.clicked.connect(self.show_as_pane_changed)
self.gui.search.cleared.connect(self.indicate_no_items)
def add_columns_to_widget(self): def add_columns_to_widget(self):
''' '''
@ -356,6 +357,7 @@ class Quickview(QDialog, Ui_Quickview):
if self.lock_qv.isChecked(): if self.lock_qv.isChecked():
return return
try:
bv_row = idx.row() bv_row = idx.row()
self.current_column = idx.column() self.current_column = idx.column()
key = self.view.column_map[self.current_column] key = self.view.column_map[self.current_column]
@ -363,6 +365,8 @@ class Quickview(QDialog, Ui_Quickview):
if self.current_book_id == book_id and self.current_key == key: if self.current_book_id == book_id and self.current_key == key:
return return
self._refresh(book_id, key) self._refresh(book_id, key)
except:
self.indicate_no_items()
def _refresh(self, book_id, key): def _refresh(self, book_id, key):
''' '''
@ -415,6 +419,8 @@ class Quickview(QDialog, Ui_Quickview):
def indicate_no_items(self): def indicate_no_items(self):
self.no_valid_items = True self.no_valid_items = True
self.items.clear() self.items.clear()
self.books_table.clear()
self.books_table.setRowCount(0)
self.items.addItem(QListWidgetItem(_('**No items found**'))) self.items.addItem(QListWidgetItem(_('**No items found**')))
self.books_label.setText(_('Click in a column in the library view ' self.books_label.setText(_('Click in a column in the library view '
'to see the information for that book')) 'to see the information for that book'))