Implement refreshdb:

This commit is contained in:
Kovid Goyal 2013-07-15 18:31:55 +05:30
parent 12cded043f
commit 67025df8ef
2 changed files with 8 additions and 7 deletions

View File

@ -112,10 +112,6 @@ Various things that require other things before they can be migrated:
libraries/switching/on calibre startup. libraries/switching/on calibre startup.
3. Port library/restore.py 3. Port library/restore.py
4. Replace the metadatabackup thread with the new implementation when using the new backend. 4. Replace the metadatabackup thread with the new implementation when using the new backend.
5. In the new API refresh() does not re-read from disk. That might break a 5. grep the sources for TODO
few things, for example content server reloading on db change as well as 6. Check that content server reloading on metadata,db change, metadata backup, refresh gui on calibredb add all work
dump/restore of db and the refreshdb: action in gui2/ui.py. Probaly you'll have to create a dedicated API for
refreshing the db from disk and change the code to use it instead of the overloaded refresh (which is often used
to reread data from the db after writing to it). See reload_from_db() in cache.py
6. grep the sources for TODO
''' '''

View File

@ -532,7 +532,12 @@ class Main(MainWindow, MainWindowMixin, DeviceMixin, EmailMixin, # {{{
self.raise_() self.raise_()
self.activateWindow() self.activateWindow()
elif msg.startswith('refreshdb:'): elif msg.startswith('refreshdb:'):
self.library_view.model().refresh() db = self.library_view.model().db
if hasattr(db, 'new_api'):
db.new_api.reload_from_db()
self.library_view.model().resort()
else:
self.library_view.model().refresh()
self.library_view.model().research() self.library_view.model().research()
self.tags_view.recount() self.tags_view.recount()
self.library_view.model().db.refresh_format_cache() self.library_view.model().db.refresh_format_cache()