Read_Timing_Constraint.py 1.4 KB

12345678910111213141516171819202122232425262728293031323334353637
  1. import os
  2. import threading
  3. from PySide2.QtWidgets import *
  4. from PySide2.QtCore import *
  5. from PySide2.QtGui import *
  6. from ui.AddFile import AddFileWindow,AddPathWindow
  7. class ReadTimeWindow(AddFileWindow):
  8. def __init__(self, parent, path) -> None:
  9. super().__init__(parent, path)
  10. self.setWindowTitle("Read Timing Constraint")
  11. self.mainWindow = parent
  12. self.move(parent.x()+(parent.width()-self.width())/2,parent.y()+(parent.height()-self.height())/2)
  13. def init(self,parent, path):
  14. self.file_type = [".sdc"]
  15. self.file_suffix = ["Supported Files(%s)" % " ".join(['*'+str(s) for s in self.file_type])]
  16. self.bnt_Apply.deleteLater()
  17. AddPathWindow.init(self, parent, path)
  18. horizontalSpacer = QSpacerItem(40, 20, QSizePolicy.Expanding, QSizePolicy.Minimum)
  19. self.horizontalLayout_2.insertItem(3, horizontalSpacer)
  20. self.show_file_list()
  21. def apply(self):
  22. abs_path = self.current_select_path()
  23. if not abs_path:
  24. return
  25. if not os.path.isfile(abs_path):
  26. return
  27. self.fileTable.clearSelection()
  28. self.fileTable.setCurrentIndex(QModelIndex())
  29. self.run_read_timing(abs_path)
  30. def run_read_timing(self, file):
  31. thread = threading.Thread(target=self.mainWindow.GUI.ReadTimingConstraint, args=(file,))
  32. thread.start()