def start(self): self.user_version = self.db.user_version self.rejected = False self.db.clean() self.db.conn.close() self.closed_orig_conn = True t = DBThread(self.db.dbpath, False) t.connect() self.conn = t.conn self.dump = self.conn.iterdump() self.statements = [] self.count = 0 self.msg.setText(_('Dumping database to SQL')) # Give the backup thread time to stop QTimer.singleShot(2000, self.do_one_dump) self.exec_()
def start(self): self.user_version = self.db.user_version self.rejected = False self.db.clean() self.db.close() self.closed_orig_conn = True t = DBThread(self.db.dbpath, False) t.connect() self.conn = t.conn self.dump = self.conn.iterdump() self.statements = [] self.count = 0 self.msg.setText(_('Dumping database to SQL')) # Give the backup thread time to stop QTimer.singleShot(2000, self.do_one_dump) self.exec_()
def start_load(self): try: self.conn.close() self.pb.setMaximum(self.count) self.pb.setValue(0) self.msg.setText(_('Loading database from SQL')) self.db.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 as e: import traceback self.error = (as_unicode(e), traceback.format_exc()) self.reject()