PySide QThread : launch one thread after another one ends

Hello guys,

I’m having a little problem on a tool I’m developping.
I have a progress bar that I use to display the progress of file copying or moving.
In one of my function, I want to do the following :

oldPath = sorted([os.path.join(self.localPath, 'old', v) for v in os.listdir(self.localPath) if not 'old' in v])[-1]
                self._print('OLD PATH :'+oldPath)
                if not os.path.exists(oldPath):
                    os.makedirs(oldPath)
                    self._print('old folder created !')
                oldSrcPath = os.path.join(self.localPath, currentLocalVersion)
                # Thread for moving files :
                print '#'*50
                print 'SRC FOR MOVING : ', oldSrcPath
                print 'DEST FOR MOVING :', oldPath
                print '#'*50
                self.moveFilesThread(oldSrcPath, oldPath)
                self._print('Moving done !')
                localVersionName = datetime.datetime.now().strftime('%Y%m%d%H%M%S')+'_'+str(boardVersion['sg_version']).zfill(3)
                self.dstPath = os.path.join(self.dstPath, localVersionName)
                print '-'*50
                print 'SRC COPY :', self.srcPath
                print 'DEST PATH :', self.dstPath

                # Then launch a new thread with the actual good copy
                self.copyFilesThread(self.srcPath, self.dstPath)
                print 'Back in main thread yeah !'

My self.moveFilesThread(oldSrcPath, oldPath) calls this function :

@QtCore.Slot(bool)
    def moveFilesThread(self, srcPath, dstPath):
        """
        Launch thread for
        :param srcPath:
        :param dstPath:
        :return:
        """

        if not self.moveInProgress or not self.moveInProgress.isRunning():
            self.progressBar.reset()
            self.progressBar.setRange(0,100)
            self.progressBar.setValue(0)
            # Starting the thread
            self.moveInProgress = GetDataThread(srcPath, dstPath, move=True)

            self.moveInProgress.info.connect(self.updateProgress)
            self.moveInProgress.complete.connect(self.copyComplete)
            self.moveInProgress.status.connect(self.updateStatus)

            self.moveInProgress.start()
            # self.moveInProgress.terminate()
            # self.moveInProgress.wait()
            print 'Moving Thread Launched !'
            self.work_btn.setEnabled(False)

I would like this thread to be finished before my second self.copyFilesThread to be executed.
I tried using wait(), but it seems my second thread is not executed.

My run() in my “worker class” looks like this :

def run(self, *args, **kwargs):
        """

        :param args:
        :param kwargs:
        :return:
        """
        filesToCopy = self.getFiles(self.srcPath, self.destPath)
        numFiles = len(filesToCopy)

        i = 1
        start = timeit.default_timer()

        for src,dest in filesToCopy.items():
            if not os.path.exists(os.path.dirname(dest)):
                os.makedirs(os.path.dirname(dest))
            if self.move:
                print("Moving "+str(i)+"/"+str(numFiles)+" files")
                statusText = "Moving "+str(i)+"/"+str(numFiles)+" files"
                shutil.move(src, dest)
            else:
                print("Copying "+str(i)+"/"+str(numFiles)+" files")
                statusText = "Copying "+str(i)+"/"+str(numFiles)+" files"
                shutil.copy2(src, dest)
            self.info.emit((i*100)/numFiles) # envoi du signal de progression
            self.status.emit(statusText)
            i += 1
        if self.move:
            shutil.rmtree(self.srcPath)
        self.complete.emit(self.error)
        elapsed = timeit.default_timer() - start
        print 'Done in ', elapsed, 'seconds ! Ain\'t that cool ??'

My problem is while i’m moving files I get updates of the copying whilst i would like to end the moving part before starting to copy.
Anyone has any idea how to achieve that ?