def newSequence(self, sequence_filename): if self.running: QtWidgets.QMessageBox.information(self, "New Sequence Request", "Please pause or abort current run") if not self.running: model = False no_error = True try: model = sequenceViewer.parseSequenceFile(sequence_filename) except: try: generated_xml_file = sequenceGenerator.generate(self, sequence_filename) model = sequenceViewer.parseSequenceFile(generated_xml_file) except: QtWidgets.QMessageBox.information(self, "Error Loading Sequence", traceback.format_exc()) no_error = False if no_error: self.ui.commandSequenceTreeView.setModel(model) self.ui.commandSequenceTreeView.setTestMode(False) self.skip_warning = False #Enable warnings for invalid commands self.sequence_validated = False #Mark sequence as unvalidated self.ui.sequenceLabel.setText(sequence_filename) self.ui.progressBar.setMaximum(self.ui.commandSequenceTreeView.getNumberItems()) self.updateRunStatusDisplay() # Set enabled/disabled status self.ui.runButton.setEnabled(True) self.ui.runButton.setText("Start") self.ui.abortButton.setEnabled(False) self.ui.validateSequenceButton.setEnabled(True)
def handleGenerateXML(self, boolean): if self.running: QtWidgets.QMessageBox.information(self, "New Sequence Request", "Please pause or abort current") else: recipe_xml_file = QtWidgets.QFileDialog.getOpenFileName( self, "Open XML File", self.directory, "XML (*.xml)")[0] if (len(recipe_xml_file) > 0): try: generated_xml_file = sequenceGenerator.generate( self, recipe_xml_file) except: generated_xml_file = None QtWidgets.QMessageBox.information(self, "Error Generating XML", traceback.format_exc()) if generated_xml_file is not None: self.directory = os.path.dirname(recipe_xml_file) self.newSequence(generated_xml_file)
def handleGenerateXML(self, boolean): if self.running: QtWidgets.QMessageBox.information(self, "New Sequence Request", "Please pause or abort current") else: recipe_xml_file = QtWidgets.QFileDialog.getOpenFileName(self, "Open XML File", self.directory, "XML (*.xml)")[0] if (len(recipe_xml_file)>0): try: generated_xml_file = sequenceGenerator.generate(self, recipe_xml_file) except: generated_xml_file = None QtWidgets.QMessageBox.information(self, "Error Generating XML", traceback.format_exc()) if generated_xml_file is not None: self.directory = os.path.dirname(recipe_xml_file) self.newSequence(generated_xml_file)