ProgressBar hinzugefügt

This commit is contained in:
Stefan Ritter 2023-10-18 10:52:37 +02:00
parent 0a7ad615c2
commit dc1d46c8ca
2 changed files with 19 additions and 6 deletions

View File

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

View File

@ -11,6 +11,8 @@ from PyQt6.QtWidgets import QDialog
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):
@ -82,7 +84,10 @@ class wArchive(QDialog):
self.bArchive = QPushButton("Archivieren", self)
self.bArchive.setGeometry(10, 350, 380, 40)
self.bArchive.setEnabled(False)
self.bArchive.clicked.connect(self.copyData)
self.bArchive.clicked.connect(self.copyDataThread)
self.progressBar = QProgressBar(self)
self.progressBar.setGeometry(10, 320, 380, 20)
archive = threading.Thread(target=self.archive)
archive.start()
@ -176,12 +181,21 @@ class wArchive(QDialog):
# Output file count
self.tLine10.setText(str(len(self.files)))
# Activate bArchive
# Activate bArchive and show progress bar
if dicomfile and dicomdir and target_writable and has_dicom_files and has_pBirth and has_pName:
self.bArchive.setEnabled(True)
def copyDataThread(self):
self.copyDataThread = threading.Thread(target=self.copyData)
self.copyDataThread.start()
self.copyDataThread.join()
# Close wArchive
self.close()
def copyData(self):
self.bArchive.setEnabled(False)
source = self.files
@ -200,13 +214,12 @@ class wArchive(QDialog):
filename = 1
for file in source:
shutil.copy(file, os.path.join(mainFolder, subFolder, str(filename)))
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)
self.close()
@staticmethod
def randomString(length):
string = ""