Andere Methode um zu überprüfen, ob eine CD im Laufwerk ist
This commit is contained in:
parent
1c9ffcf342
commit
1943f7d3dc
@ -1,3 +1,4 @@
|
|||||||
PyQt6
|
PyQt6
|
||||||
pydicom
|
pydicom
|
||||||
pyinstaller
|
pyinstaller
|
||||||
|
wmi
|
||||||
|
54
warchive.py
54
warchive.py
@ -6,6 +6,7 @@ import pydicom
|
|||||||
import shutil
|
import shutil
|
||||||
import random
|
import random
|
||||||
import ctypes
|
import ctypes
|
||||||
|
import wmi
|
||||||
from registry import Registry
|
from registry import Registry
|
||||||
from PyQt6.QtWidgets import QDialog
|
from PyQt6.QtWidgets import QDialog
|
||||||
from PyQt6.QtWidgets import QLabel
|
from PyQt6.QtWidgets import QLabel
|
||||||
@ -45,40 +46,45 @@ class wArchive(QDialog):
|
|||||||
self.tLine3 = QLabel("", self)
|
self.tLine3 = QLabel("", self)
|
||||||
self.tLine3.setGeometry(column2s, 50, column2w, 20)
|
self.tLine3.setGeometry(column2s, 50, column2w, 20)
|
||||||
|
|
||||||
|
self.lLine3a = QLabel("CD im Laufwerk:", self)
|
||||||
|
self.lLine3a.setGeometry(10, 70, column1w, 20)
|
||||||
|
self.tLine3a = QLabel("", self)
|
||||||
|
self.tLine3a.setGeometry(column2s, 70, column2w, 20)
|
||||||
|
|
||||||
self.lLine4 = QLabel("DICOMDIR-Datei gefunden:", self)
|
self.lLine4 = QLabel("DICOMDIR-Datei gefunden:", self)
|
||||||
self.lLine4.setGeometry(10, 70, column1w, 20)
|
self.lLine4.setGeometry(10, 90, column1w, 20)
|
||||||
self.tLine4 = QLabel("", self)
|
self.tLine4 = QLabel("", self)
|
||||||
self.tLine4.setGeometry(column2s, 70, column2w, 20)
|
self.tLine4.setGeometry(column2s, 90, column2w, 20)
|
||||||
|
|
||||||
self.lLine5 = QLabel("DICOM-Verzeichnis gefunden:", self)
|
self.lLine5 = QLabel("DICOM-Verzeichnis gefunden:", self)
|
||||||
self.lLine5.setGeometry(10, 90, column1w, 20)
|
self.lLine5.setGeometry(10, 110, column1w, 20)
|
||||||
self.tLine5 = QLabel("", self)
|
self.tLine5 = QLabel("", self)
|
||||||
self.tLine5.setGeometry(column2s, 90, column2w, 20)
|
self.tLine5.setGeometry(column2s, 110, column2w, 20)
|
||||||
|
|
||||||
self.lLine6 = QLabel("Archiv beschreibbar:", self)
|
self.lLine6 = QLabel("Archiv beschreibbar:", self)
|
||||||
self.lLine6.setGeometry(10, 110, column1w, 20)
|
self.lLine6.setGeometry(10, 130, column1w, 20)
|
||||||
self.tLine6 = QLabel("", self)
|
self.tLine6 = QLabel("", self)
|
||||||
self.tLine6.setGeometry(column2s, 110, column2w, 20)
|
self.tLine6.setGeometry(column2s, 130, column2w, 20)
|
||||||
|
|
||||||
self.lLine7 = QLabel("DICOM-Dateien gefunden:", self)
|
self.lLine7 = QLabel("DICOM-Dateien gefunden:", self)
|
||||||
self.lLine7.setGeometry(10, 130, column1w, 20)
|
self.lLine7.setGeometry(10, 150, column1w, 20)
|
||||||
self.tLine7 = QLabel("", self)
|
self.tLine7 = QLabel("", self)
|
||||||
self.tLine7.setGeometry(column2s, 130, column2w, 20)
|
self.tLine7.setGeometry(column2s, 150, column2w, 20)
|
||||||
|
|
||||||
self.lLine8 = QLabel("Name:", self)
|
self.lLine8 = QLabel("Name:", self)
|
||||||
self.lLine8.setGeometry(10, 150, column1w, 20)
|
self.lLine8.setGeometry(10, 170, column1w, 20)
|
||||||
self.tLine8 = QLabel("", self)
|
self.tLine8 = QLabel("", self)
|
||||||
self.tLine8.setGeometry(column2s, 150, column2w, 20)
|
self.tLine8.setGeometry(column2s, 170, column2w, 20)
|
||||||
|
|
||||||
self.lLine9 = QLabel("Geburtsdatum:", self)
|
self.lLine9 = QLabel("Geburtsdatum:", self)
|
||||||
self.lLine9.setGeometry(10, 170, column1w, 20)
|
self.lLine9.setGeometry(10, 190, column1w, 20)
|
||||||
self.tLine9 = QLabel("", self)
|
self.tLine9 = QLabel("", self)
|
||||||
self.tLine9.setGeometry(column2s, 170, column2w, 20)
|
self.tLine9.setGeometry(column2s, 190, column2w, 20)
|
||||||
|
|
||||||
self.lLine10 = QLabel("Dateien:", self)
|
self.lLine10 = QLabel("Dateien:", self)
|
||||||
self.lLine10.setGeometry(10, 190, column1w, 20)
|
self.lLine10.setGeometry(10, 210, column1w, 20)
|
||||||
self.tLine10 = QLabel("", self)
|
self.tLine10 = QLabel("", self)
|
||||||
self.tLine10.setGeometry(column2s, 190, column2w, 20)
|
self.tLine10.setGeometry(column2s, 210, column2w, 20)
|
||||||
|
|
||||||
self.bArchive = QPushButton("Archivieren", self)
|
self.bArchive = QPushButton("Archivieren", self)
|
||||||
self.bArchive.setGeometry(10, 350, 380, 40)
|
self.bArchive.setGeometry(10, 350, 380, 40)
|
||||||
@ -107,6 +113,7 @@ class wArchive(QDialog):
|
|||||||
self.tLine3.setText(self.CDRomPath + ":\\")
|
self.tLine3.setText(self.CDRomPath + ":\\")
|
||||||
|
|
||||||
# Logic
|
# Logic
|
||||||
|
cd_check = False
|
||||||
dicomfile = False
|
dicomfile = False
|
||||||
dicomdir = False
|
dicomdir = False
|
||||||
target_writable = False
|
target_writable = False
|
||||||
@ -114,6 +121,20 @@ class wArchive(QDialog):
|
|||||||
has_pName = False
|
has_pName = False
|
||||||
has_pBirth = False
|
has_pBirth = False
|
||||||
|
|
||||||
|
# Check CD drive
|
||||||
|
cds = wmi.WMI()
|
||||||
|
for cd in cds.Win32_CDROMDrive():
|
||||||
|
if cd.MediaLoaded:
|
||||||
|
cd_check = True
|
||||||
|
|
||||||
|
if cd_check:
|
||||||
|
self.tLine3a.setText(okay)
|
||||||
|
self.tLine3a.setStyleSheet("color: green")
|
||||||
|
else:
|
||||||
|
self.tLine3a.setText(notokay)
|
||||||
|
self.tLine3a.setStyleSheet("color: red")
|
||||||
|
|
||||||
|
if cd_check:
|
||||||
# Check if DICOMDIR file exists
|
# Check if DICOMDIR file exists
|
||||||
if os.path.isfile(os.path.join(self.CDRomPath + ":", os.sep, "DICOMDIR")):
|
if os.path.isfile(os.path.join(self.CDRomPath + ":", os.sep, "DICOMDIR")):
|
||||||
dicomfile = True
|
dicomfile = True
|
||||||
@ -197,7 +218,8 @@ class wArchive(QDialog):
|
|||||||
threads.append(self.copyDataThread)
|
threads.append(self.copyDataThread)
|
||||||
self.copyDataThread.start()
|
self.copyDataThread.start()
|
||||||
|
|
||||||
class copyData():
|
|
||||||
|
class copyData:
|
||||||
def __init__(self, warchive, barchive, progressbar, files, archivepath, pname, pbirth):
|
def __init__(self, warchive, barchive, progressbar, files, archivepath, pname, pbirth):
|
||||||
self.warchive = warchive
|
self.warchive = warchive
|
||||||
self.barchive = barchive
|
self.barchive = barchive
|
||||||
@ -229,7 +251,7 @@ class copyData():
|
|||||||
self.barchive.setEnabled(True)
|
self.barchive.setEnabled(True)
|
||||||
self.warchive.hide()
|
self.warchive.hide()
|
||||||
|
|
||||||
@staticmethod
|
|
||||||
def randomString(length):
|
def randomString(length):
|
||||||
string = ""
|
string = ""
|
||||||
chars = "abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ1234567890"
|
chars = "abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ1234567890"
|
||||||
|
Loading…
Reference in New Issue
Block a user