From 6f8cdbe41ae1e3d51605707dc060961cf037e177 Mon Sep 17 00:00:00 2001 From: Kovid Goyal Date: Sat, 29 Jan 2011 08:30:54 -0700 Subject: [PATCH] ... --- src/calibre/gui2/dialogs/check_library.py | 34 +++++++++++++---------- 1 file changed, 20 insertions(+), 14 deletions(-) diff --git a/src/calibre/gui2/dialogs/check_library.py b/src/calibre/gui2/dialogs/check_library.py index bd665a7e2e..b6b15d8be8 100644 --- a/src/calibre/gui2/dialogs/check_library.py +++ b/src/calibre/gui2/dialogs/check_library.py @@ -74,21 +74,27 @@ class DBCheck(QDialog): self.reject() def start_load(self): - self.conn.close() - self.pb.setMaximum(self.count) - self.pb.setValue(0) - self.msg.setText(_('Loading database from SQL')) - self.db.conn.close() - self.ndbpath = PersistentTemporaryFile('.db') - self.ndbpath.close() - self.ndbpath = self.ndbpath.name - t = DBThread(self.ndbpath, False) - t.connect() - self.conn = t.conn - self.conn.execute('create temporary table temp_sequence(id INTEGER PRIMARY KEY AUTOINCREMENT)') - self.conn.commit() + try: + self.conn.close() + self.pb.setMaximum(self.count) + self.pb.setValue(0) + self.msg.setText(_('Loading database from SQL')) + self.db.conn.close() + self.ndbpath = PersistentTemporaryFile('.db') + self.ndbpath.close() + self.ndbpath = self.ndbpath.name + t = DBThread(self.ndbpath, False) + t.connect() + self.conn = t.conn + self.conn.execute('create temporary table temp_sequence(id INTEGER PRIMARY KEY AUTOINCREMENT)') + self.conn.commit() + + QTimer.singleShot(0, self.do_one_load) + except Exception, e: + import traceback + self.error = (as_unicode(e), traceback.format_exc()) + self.reject() - QTimer.singleShot(0, self.do_one_load) def do_one_load(self): if self.rejected: