import threading from PySide2.QtWidgets import * from PySide2.QtCore import * from PySide2.QtGui import * from ui.ui_ReportVirtualTiming import Ui_ReportVirtualTiming class ReportVirtualTiming(Ui_ReportVirtualTiming, QDialog): def __init__(self, mainWindow) -> None: super().__init__(mainWindow, Qt.WindowStaysOnTopHint) self.setupUi(self) self.lineEdit_endpoint.setValidator(QRegExpValidator(QRegExp("[0-9]+$"))) self.lineEdit_endpoint.setPlaceholderText("please enter a number") self.btn_ok.clicked.connect(self.report_virtual_timing) self.mainWindow = mainWindow self.move(mainWindow.x()+(mainWindow.width()-self.width())/2,mainWindow.y()+(mainWindow.height()-self.height())/2) # 调整对话框大小以适应内容 self.adjustSize() def report_virtual_timing(self): from_type = self.comboBox_from.currentText() from_ = self.lineEdit_from.text() thru_type = self.comboBox_through.currentText() thru = self.lineEdit_through.text() to_type = self.comboBox_to.currentText() to = self.lineEdit_to.text() flat = self.Flat.isChecked() if self.lineEdit_endpoint.text(): limit = int(self.lineEdit_endpoint.text()) else: limit = 0 # ReportVirtualTiming(self, from_type, from_, thru_type, thru, to_type, to, flat, limit): thread = threading.Thread(target=self.mainWindow.GUI.ReportVirtualTiming, args=(from_type, from_, thru_type, thru, to_type, to, flat, limit)) thread.start() self.close()