View Single Post
Old 09-17-2014, 10:24 AM   #1
DaltonST
Deviser
DaltonST ought to be getting tired of karma fortunes by now.DaltonST ought to be getting tired of karma fortunes by now.DaltonST ought to be getting tired of karma fortunes by now.DaltonST ought to be getting tired of karma fortunes by now.DaltonST ought to be getting tired of karma fortunes by now.DaltonST ought to be getting tired of karma fortunes by now.DaltonST ought to be getting tired of karma fortunes by now.DaltonST ought to be getting tired of karma fortunes by now.DaltonST ought to be getting tired of karma fortunes by now.DaltonST ought to be getting tired of karma fortunes by now.DaltonST ought to be getting tired of karma fortunes by now.
 
DaltonST's Avatar
 
Posts: 2,265
Karma: 2090983
Join Date: Aug 2013
Location: Texas
Device: none
Forcing Total Cache & GUI Refresh Without Restarting

I would like to change a lot of jobs from requiring a restart due to the large number of custom columns being updated in native sqlite(via apsw) in the background. From a user-friendliness perspective, a restart is annoying. To that end, I have been attempting multiple methods to obviate the need to restart Calibre after a job finishes. So far, none of the methods shown below refresh the entire GUI. Is there a fast and safe way to refresh the entire GUI?

#----------------------------------------------------------------------
def force_refresh_of_cache_and_gui(self, list_of_ids, row_list):

backend = self.gui.library_view.model().db.backend

#test the apsw connection to ensure 'backend' is valid...
backend.execute('SELECT id FROM custom_column_16')
#debug shows an apsw cursor object...so, 'backend' is valid

# method 1
mydbcache = dbcache(backend)
mydbcache.reload_from_db(clear_caches=True)

# method 2
self.gui.library_view.model().refresh_ids(list( list_of_ids ))
self.gui.tags_view.recount()

# method 3
m = self.gui.library_view.model()
m.refresh_rows(row_list)
self.gui.tags_view.recount()


#above completes with no errors or warnings, but gui visible columns do not refresh.
#so, have to restart anyway.

self.gui.quit(restart=True)

#----------------------------------------------------------------------
DaltonST is offline   Reply With Quote