ReportVirtualTiming.py 1.6 KB

1234567891011121314151617181920212223242526272829303132333435
  1. import threading
  2. from PySide2.QtWidgets import *
  3. from PySide2.QtCore import *
  4. from PySide2.QtGui import *
  5. from ui.ui_ReportVirtualTiming import Ui_ReportVirtualTiming
  6. class ReportVirtualTiming(Ui_ReportVirtualTiming, QDialog):
  7. def __init__(self, mainWindow) -> None:
  8. super().__init__(mainWindow, Qt.WindowStaysOnTopHint)
  9. self.setupUi(self)
  10. self.lineEdit_endpoint.setValidator(QRegExpValidator(QRegExp("[0-9]+$")))
  11. self.lineEdit_endpoint.setPlaceholderText("please enter a number")
  12. self.btn_ok.clicked.connect(self.report_virtual_timing)
  13. self.mainWindow = mainWindow
  14. self.move(mainWindow.x()+(mainWindow.width()-self.width())/2,mainWindow.y()+(mainWindow.height()-self.height())/2)
  15. # 调整对话框大小以适应内容
  16. self.adjustSize()
  17. def report_virtual_timing(self):
  18. from_type = self.comboBox_from.currentText()
  19. from_ = self.lineEdit_from.text()
  20. thru_type = self.comboBox_through.currentText()
  21. thru = self.lineEdit_through.text()
  22. to_type = self.comboBox_to.currentText()
  23. to = self.lineEdit_to.text()
  24. flat = self.Flat.isChecked()
  25. if self.lineEdit_endpoint.text():
  26. limit = int(self.lineEdit_endpoint.text())
  27. else:
  28. limit = 0
  29. # ReportVirtualTiming(self, from_type, from_, thru_type, thru, to_type, to, flat, limit):
  30. thread = threading.Thread(target=self.mainWindow.GUI.ReportVirtualTiming, args=(from_type, from_, thru_type, thru, to_type, to, flat, limit))
  31. thread.start()
  32. self.close()