Fix error generated when changing libraries with the quickview window open

This commit is contained in:
Kovid Goyal 2013-05-25 16:07:24 +05:30
commit 6db4717ef1

View File

@ -134,7 +134,16 @@ class Quickview(QDialog, Ui_Quickview):
def book_was_changed(self, mi): def book_was_changed(self, mi):
if self.is_closed or self.current_column is None: if self.is_closed or self.current_column is None:
return return
self.refresh(self.view.model().index(self.db.row(mi.id), self.current_column)) # There is an ordering problem when libraries are changed. The library
# view is changed, triggering a book_was_changed signal. Unfortunately
# this happens before the library_changed actions are run, meaning we
# still have the old database. To avoid the problem we just ignore the
# operation if we get an exception. The set_database will come
# eventually.
try:
self.refresh(self.view.model().index(self.db.row(mi.id), self.current_column))
except:
pass
# clicks on the items listWidget # clicks on the items listWidget
def item_selected(self, txt): def item_selected(self, txt):