Fix template formatter functions not being reloaded asfter a check library operation

Fix an error during shutdown caused by some library closed plugins

Merge branch 'master' of https://github.com/cbhaley/calibre
This commit is contained in:
Kovid Goyal 2017-03-11 23:56:31 +05:30
commit ac1fd2b9b3
4 changed files with 9 additions and 12 deletions

View File

@ -493,16 +493,16 @@ class ChooseLibraryAction(InterfaceAction):
m.stop_metadata_backup()
db = m.db
db.prefs.disable_setting = True
library_path = db.library_path
d = DBCheck(self.gui, db)
d.start()
try:
d.conn.close()
m.close()
except:
pass
d.break_cycles()
self.gui.library_moved(db.library_path, call_close=not
d.closed_orig_conn)
self.gui.library_moved(library_path, call_close=False)
if d.rejected:
return
if d.error is None:

View File

@ -37,7 +37,6 @@ class DBCheck(QDialog): # {{{
self.resize(self.sizeHint() + QSize(100, 50))
self.error = None
self.db = db.new_api
self.closed_orig_conn = False
self.rejected = False
def start(self):

View File

@ -38,6 +38,7 @@ def human_readable(size, precision=1):
""" Convert a size in bytes into megabytes """
return ('%.'+str(precision)+'f') % ((size/(1024.*1024.)),)
TIME_FMT = '%d %b %Y'
ALIGNMENT_MAP = {'left': Qt.AlignLeft, 'right': Qt.AlignRight, 'center':
@ -333,6 +334,7 @@ class BooksModel(QAbstractTableModel): # {{{
self.new_bookdisplay_data.emit(self.get_book_display_info(current_row))
def close(self):
if self.db is not None:
self.db.close()
self.db = None
self.beginResetModel(), self.endResetModel()
@ -1710,6 +1712,3 @@ class DeviceBooksModel(BooksModel): # {{{
self.editable = []
# }}}

View File

@ -955,8 +955,7 @@ class Main(MainWindow, MainWindowMixin, DeviceMixin, EmailMixin, # {{{
if mb is not None:
mb.stop()
if db is not None:
db.close()
self.library_view.model().close()
try:
try: