Example #1
0
    def documentFromDockerfile(self, filename):
        doc = QTextDocument(self)
        doc.setDocumentLayout(QtWidgets.QPlainTextDocumentLayout(doc))
        if filename == "-SCRATCH-":
            doc.setPlainText("")
        else:
            with open(filename, 'r') as f:
                doc.setPlainText(f.read())
        doc.setDefaultFont(self.fontDockerfileEditor)
        doc.highlighter = DockerSyntaxHighlighter(doc)
        #doc.modificationChanged[bool].connect(self.onModificationChanged)
        doc.setModified(False)
        self._cachedDocument = doc
        self.txtDockerfile.setDocument(doc)

        plainText = self.txtDockerfile.toPlainText()
        if self._find_bioclite(self.FLAG_binder_string, plainText):
            self.FLAG_binder_compatible = True
        else:
            self.FLAG_binder_compatible = False

        return self._cachedDocument