Untitled

mail@pastecode.io avatar
unknown
python
2 years ago
1.3 kB
2
Indexable
Never
def get_specs():
    si = subprocess.STARTUPINFO()
    si.dwFlags |= subprocess.STARTF_USESHOWWINDOW
    subprocess.call('dxdiag /x dxdiag.xml', startupinfo=si)
    root = xml.parse('dxdiag.xml').getroot()
    sysinfo = root.find('SystemInformation')
    display = root.find('DisplayDevices').find('DisplayDevice')
    result = "Name:                  " + sysinfo.find('MachineName').text + "\n"
    result += "OS:                      " + sysinfo.find('OperatingSystem').text.split('(')[0] + "\n"
    result += "CPU:                    " + sysinfo.find('Processor').text.split('Hz')[0] + "Hz" + "\n"
    result += "Memory:               " + sysinfo.find('Memory').text + "\n"
    result += "Page file:              " + sysinfo.find('PageFile').text + "\n"
    result += "Graphics card:     " + display.find('ChipType').text + "\n"
    result += "Manufacturer:       " + display.find('Manufacturer').text + "\n"
    os.remove('dxdiag.xml')
    specs.setText(result)
    specs.adjustSize()
    global msg_box
    msg_box = QMessageBox()
    msg_box.setWindowTitle("Error")
    msg_box.setText('SORRY! YOUR SYSTEM DOES NOT MEET THE REQUIREMENTS TO USE THIS PROGRAM.')
    msg_box.addButton('Ok', QMessageBox.YesRole)
    QTimer.singleShot(500, lambda: msg_box.show())