This commit is contained in:
Kovid Goyal 2011-01-29 08:30:54 -07:00
parent ad33d230e6
commit 6f8cdbe41a

View File

@ -74,21 +74,27 @@ class DBCheck(QDialog):
self.reject() self.reject()
def start_load(self): def start_load(self):
self.conn.close() try:
self.pb.setMaximum(self.count) self.conn.close()
self.pb.setValue(0) self.pb.setMaximum(self.count)
self.msg.setText(_('Loading database from SQL')) self.pb.setValue(0)
self.db.conn.close() self.msg.setText(_('Loading database from SQL'))
self.ndbpath = PersistentTemporaryFile('.db') self.db.conn.close()
self.ndbpath.close() self.ndbpath = PersistentTemporaryFile('.db')
self.ndbpath = self.ndbpath.name self.ndbpath.close()
t = DBThread(self.ndbpath, False) self.ndbpath = self.ndbpath.name
t.connect() t = DBThread(self.ndbpath, False)
self.conn = t.conn t.connect()
self.conn.execute('create temporary table temp_sequence(id INTEGER PRIMARY KEY AUTOINCREMENT)') self.conn = t.conn
self.conn.commit() 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): def do_one_load(self):
if self.rejected: if self.rejected: