class Reader(QObject): folderStatusUpdated = pyqtSignal(int, int) fileStatusUpdated = pyqtSignal(int, int) ready = pyqtSignal() _curThread = None def __init__(self): super(Reader, self).__init__() self.dbi = DBInterface() self.dbi.clear_db() def save_folder(self, folderPath, dbName): DBHandler().disconnect() thread = ReaderThread(self.dbi, "folder", folderPath, dbName) thread.folderStatusUpdated.connect(self.folderStatusUpdated) thread.fileStatusUpdated.connect(self.fileStatusUpdated) thread.ready.connect(self.ready) thread.start() self._curThread = thread def save_file(self, filePath): DBHandler().disconnect() thread = ReaderThread(self.dbi, "file", filePath) thread.folderStatusUpdated.connect(self.folderStatusUpdated) thread.fileStatusUpdated.connect(self.fileStatusUpdated) thread.ready.connect(self.ready) thread.start() self._curThread = thread
def __init__(self): super(Reader, self).__init__() self.dbi = DBInterface() self.dbi.clear_db()