import os import threading from PySide2.QtWidgets import * from PySide2.QtCore import * from PySide2.QtGui import * from ui.AddFile import AddFileWindow,AddPathWindow class ReadTimeWindow(AddFileWindow): def __init__(self, parent, path) -> None: super().__init__(parent, path) self.setWindowTitle("Read Timing Constraint") self.mainWindow = parent self.move(parent.x()+(parent.width()-self.width())/2,parent.y()+(parent.height()-self.height())/2) def init(self,parent, path): self.file_type = [".sdc"] self.file_suffix = ["Supported Files(%s)" % " ".join(['*'+str(s) for s in self.file_type])] self.bnt_Apply.deleteLater() AddPathWindow.init(self, parent, path) horizontalSpacer = QSpacerItem(40, 20, QSizePolicy.Expanding, QSizePolicy.Minimum) self.horizontalLayout_2.insertItem(3, horizontalSpacer) self.show_file_list() def apply(self): abs_path = self.current_select_path() if not abs_path: return if not os.path.isfile(abs_path): return self.fileTable.clearSelection() self.fileTable.setCurrentIndex(QModelIndex()) self.run_read_timing(abs_path) def run_read_timing(self, file): thread = threading.Thread(target=self.mainWindow.GUI.ReadTimingConstraint, args=(file,)) thread.start()