def OpenChip(self): filename, filterType = QFileDialog.getOpenFileName( self, "Browse for Chip", filter="uChip Project File (*.ucc)") if filename: if not self.CloseChip(): return AppGlobals.OpenChip(Chip.LoadFromFile(Path(filename)))
def __init__(self): super().__init__() AppGlobals.Instance().onChipDataModified.connect(self.UpdateTitle) AppGlobals.Instance().onChipOpened.connect(self.UpdateTitle) AppGlobals.Instance().onChipSaved.connect(self.UpdateTitle) StylesheetLoader.RegisterWidget(self) self.chipEditor = ChipEditor() self.setCentralWidget(self.chipEditor) self.resize(self.screen().size() / 2) self.move(self.screen().size().width() / 2, 0) self.setWindowIcon(QIcon("Images/UCIcon.png")) self._rigViewer = RigViewer() self._editorWindow = ProgramEditorWindow() self._programList = ProgramList(self) self._programList.onProgramEditRequest.connect(self.EditProgram) self._runningProgramsList = RunningProgramsList() self._editorWindow.setVisible(False) menuBar = MenuBar() menuBar.new.connect(self.NewChip) menuBar.open.connect(self.OpenChip) menuBar.save.connect(self.SaveChip) menuBar.saveAs.connect(lambda: self.SaveChip(True)) menuBar.exit.connect(self.close) menuBar.showRigView.connect(self.ShowRigWidget) menuBar.showProgramList.connect(self.ShowProgramList) menuBar.zoomToFit.connect(self.chipEditor.viewer.Recenter) self.updateWorker = ProgramRunnerWorker(self) self.updateWorker.start() killTimer = QTimer(self) killTimer.timeout.connect(self.CheckForKill) killTimer.start(1000) self.setMenuBar(menuBar) self.ShowRigWidget() self.ShowProgramList() self.ShowProgramEditorWindow() self.ShowRunningProgramsList() self._editorWindow.close() AppGlobals.OpenChip(Chip())
def NewChip(self): if self.CloseChip(): AppGlobals.OpenChip(Chip())