Quote:
Originally Posted by kovidgoyal
To fully update the GUI after adding new books you would need to do
db.data.books_added(book_ids)
self.gui.library_view.model().books_added(num)
self.gui.db_images.reset()
self.gui.tags_view.recount()
This updates all the various components of the GUI.
|
This works fine for me when adding new books, but if my plugin adds a format to the book that happens to be the current selection, none of the above makes that new format show up (without selecting something else and coming back). It's very possible it's supposed to work that way, which is why I'm checking.
Would there be any downside to adding the following code to your suggested snippet in a general "GUI refresh" utility-method within a plugin?:
Code:
current_idx = self.gui.library_view.currentIndex()
if current_idx.isValid():
self.gui.library_view.model().current_changed(current_idx, current_idx)
Or is there another/better way to refresh that currently selected book's details in the gui?
(Using the new api's "add_format" method if that's relevant)