From 9b28048159b396e44b1ff031aa503725971046fc Mon Sep 17 00:00:00 2001 From: Kovid Goyal Date: Fri, 26 Feb 2010 15:22:25 -0700 Subject: [PATCH] Refresh cover browser when a cover is changed via the edit meta information dialog --- src/calibre/ebooks/__init__.py | 1 + src/calibre/gui2/library.py | 4 ++++ src/calibre/gui2/ui.py | 6 +++++- 3 files changed, 10 insertions(+), 1 deletion(-) diff --git a/src/calibre/ebooks/__init__.py b/src/calibre/ebooks/__init__.py index 0b3d6b901a..c266414e70 100644 --- a/src/calibre/ebooks/__init__.py +++ b/src/calibre/ebooks/__init__.py @@ -135,5 +135,6 @@ def check_ebook_format(stream, current_guess): stream.seek(0) if stream.read(3) == 'TPZ': ans = 'tpz' + stream.seek(0) return ans diff --git a/src/calibre/gui2/library.py b/src/calibre/gui2/library.py index 4be4156f1b..75e3411fdf 100644 --- a/src/calibre/gui2/library.py +++ b/src/calibre/gui2/library.py @@ -211,6 +211,10 @@ class BooksModel(QAbstractTableModel): if rows: self.refresh_rows(rows, current_row=current_row) + def refresh_cover_cache(self, ids): + if self.cover_cache: + self.cover_cache.refresh(ids) + def refresh_rows(self, rows, current_row=-1): for row in rows: if self.cover_cache: diff --git a/src/calibre/gui2/ui.py b/src/calibre/gui2/ui.py index 4a10a7b0f6..abafd4e58c 100644 --- a/src/calibre/gui2/ui.py +++ b/src/calibre/gui2/ui.py @@ -1292,7 +1292,11 @@ class Main(MainWindow, Ui_MainWindow, DeviceGUI): break if rows: current = self.library_view.currentIndex() - self.library_view.model().current_changed(current, previous) + m = self.library_view.model() + m.refresh_cover_cache(map(m.id, rows)) + if self.cover_flow: + self.cover_flow.dataChanged() + m.current_changed(current, previous) def edit_bulk_metadata(self, checked): '''