def setDocument(self, doc): self.lilyChooser.setLilyPondInfo(command.info(doc)) job = jobmanager.job(doc) if job and job.is_running() and not jobattributes.get(job).hidden: self._document = doc self.buttons.button(QDialogButtonBox.Ok).setEnabled(False)