This commit is contained in:
Stefan Ritter 2023-10-18 23:58:09 +02:00
parent dc1d46c8ca
commit 5ab2c2f97d
2 changed files with 38 additions and 29 deletions

View File

@ -1,7 +1,7 @@
from PyQt6.QtWidgets import QApplication
from wmain import wMain
version = "20231018"
version = "20231019"
if __name__ == "__main__":
app = QApplication([])

View File

@ -12,7 +12,6 @@ from PyQt6.QtWidgets import QLabel
from PyQt6.QtWidgets import QPushButton
from PyQt6.QtWidgets import QStyle
from PyQt6.QtWidgets import QProgressBar
from PyQt6.QtCore import QThread
class wArchive(QDialog):
@ -187,41 +186,51 @@ class wArchive(QDialog):
self.bArchive.setEnabled(True)
def copyDataThread(self):
self.copyDataThread = threading.Thread(target=self.copyData)
threads = []
self.copyDataThread = threading.Thread(target=copyData, args=(self,
self.bArchive,
self.progressBar,
self.files,
self.ArchivePath,
self.pName,
self.pBirth,))
threads.append(self.copyDataThread)
self.copyDataThread.start()
self.copyDataThread.join()
# Close wArchive
self.close()
class copyData():
def __init__(self, warchive, barchive, progressbar, files, archivepath, pname, pbirth):
self.warchive = warchive
self.barchive = barchive
self.progressbar = progressbar
self.files = files
self.archivepath = archivepath
self.pname = pname
self.pbirth = pbirth
def copyData(self):
self.barchive.setEnabled(False)
self.bArchive.setEnabled(False)
source = self.files
# LastName^FirstName^Birth
mainFolder = os.path.join(self.ArchivePath, self.pName + "^" + self.pBirth)
mainFolder = os.path.join(self.archivepath, self.pname + "^" + self.pbirth)
try:
os.mkdir(mainFolder)
except:
pass
# LastName^FirstName^Birth\1234
subFolder = self.randomString(4)
subFolder = randomString(4)
os.mkdir(os.path.join(mainFolder, subFolder))
filename = 1
for file in source:
for file in self.files:
shutil.copy(file, os.path.join(mainFolder, subFolder, str(filename)))
self.progressBar.setValue(int(filename / len(self.files) * 100))
self.progressbar.setValue(int(filename / len(self.files) * 100))
filename += 1
# Eject CD
ctypes.windll.WINMM.mciSendStringW(u"set cdaudio door open", None, 0, None)
@staticmethod
def randomString(length):
self.barchive.setEnabled(True)
self.warchive.hide()
@staticmethod
def randomString(length):
string = ""
chars = "abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ1234567890"