ProgressBar hinzugefügt
This commit is contained in:
parent
0a7ad615c2
commit
dc1d46c8ca
2
main.py
2
main.py
@ -1,7 +1,7 @@
|
|||||||
from PyQt6.QtWidgets import QApplication
|
from PyQt6.QtWidgets import QApplication
|
||||||
from wmain import wMain
|
from wmain import wMain
|
||||||
|
|
||||||
version = "20231017"
|
version = "20231018"
|
||||||
|
|
||||||
if __name__ == "__main__":
|
if __name__ == "__main__":
|
||||||
app = QApplication([])
|
app = QApplication([])
|
||||||
|
21
warchive.py
21
warchive.py
@ -11,6 +11,8 @@ from PyQt6.QtWidgets import QDialog
|
|||||||
from PyQt6.QtWidgets import QLabel
|
from PyQt6.QtWidgets import QLabel
|
||||||
from PyQt6.QtWidgets import QPushButton
|
from PyQt6.QtWidgets import QPushButton
|
||||||
from PyQt6.QtWidgets import QStyle
|
from PyQt6.QtWidgets import QStyle
|
||||||
|
from PyQt6.QtWidgets import QProgressBar
|
||||||
|
from PyQt6.QtCore import QThread
|
||||||
|
|
||||||
|
|
||||||
class wArchive(QDialog):
|
class wArchive(QDialog):
|
||||||
@ -82,7 +84,10 @@ class wArchive(QDialog):
|
|||||||
self.bArchive = QPushButton("Archivieren", self)
|
self.bArchive = QPushButton("Archivieren", self)
|
||||||
self.bArchive.setGeometry(10, 350, 380, 40)
|
self.bArchive.setGeometry(10, 350, 380, 40)
|
||||||
self.bArchive.setEnabled(False)
|
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 = threading.Thread(target=self.archive)
|
||||||
archive.start()
|
archive.start()
|
||||||
@ -177,11 +182,20 @@ class wArchive(QDialog):
|
|||||||
# Output file count
|
# Output file count
|
||||||
self.tLine10.setText(str(len(self.files)))
|
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:
|
if dicomfile and dicomdir and target_writable and has_dicom_files and has_pBirth and has_pName:
|
||||||
self.bArchive.setEnabled(True)
|
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):
|
def copyData(self):
|
||||||
|
|
||||||
self.bArchive.setEnabled(False)
|
self.bArchive.setEnabled(False)
|
||||||
|
|
||||||
source = self.files
|
source = self.files
|
||||||
@ -200,13 +214,12 @@ class wArchive(QDialog):
|
|||||||
filename = 1
|
filename = 1
|
||||||
for file in source:
|
for file in source:
|
||||||
shutil.copy(file, os.path.join(mainFolder, subFolder, str(filename)))
|
shutil.copy(file, os.path.join(mainFolder, subFolder, str(filename)))
|
||||||
|
self.progressBar.setValue(int(filename / len(self.files) * 100))
|
||||||
filename += 1
|
filename += 1
|
||||||
|
|
||||||
# Eject CD
|
# Eject CD
|
||||||
ctypes.windll.WINMM.mciSendStringW(u"set cdaudio door open", None, 0, None)
|
ctypes.windll.WINMM.mciSendStringW(u"set cdaudio door open", None, 0, None)
|
||||||
|
|
||||||
self.close()
|
|
||||||
|
|
||||||
@staticmethod
|
@staticmethod
|
||||||
def randomString(length):
|
def randomString(length):
|
||||||
string = ""
|
string = ""
|
||||||
|
Loading…
Reference in New Issue
Block a user