Esempio n. 1
0
 def createLexer(self, paper, style_name, groupName):
     style = self.loadStyle(style_name, groupName)
     if groupName == "Python":
         lexer = PythonLexer.PythonLexer(style, paper)
     elif groupName == "Xml":
         lexer = XmlLexer.XmlLexer(style, paper)
     elif groupName == "Html":
         lexer = HtmlLexer.HtmlLexer(style, paper)
     elif groupName == "Css":
         lexer = CssLexer.CssLexer(style, paper)
     return lexer
Esempio n. 2
0
    def updatePropertyListWidget(self, groupName):
        if groupName == "Python":
            styles = PythonLexer.styleDescriptions()
        elif groupName == "Css":
            styles = CssLexer.styleDescriptions()
        elif groupName == "Xml":
            styles = XmlLexer.styleDescriptions()
        elif groupName == "Html":
            styles = HtmlLexer.styleDescriptions()

        self.propertyListWidget.clear()
        for i in styles:
            self.propertyListWidget.addItem(i)
        self.propertyListWidget.setCurrentRow(0)
Esempio n. 3
0
    def updatePropertyListWidget(self, groupName):
        if groupName == "Python":
            styles = PythonLexer.styleDescriptions()
        elif groupName == "Css":
            styles = CssLexer.styleDescriptions()
        elif groupName == "Xml":
            styles = XmlLexer.styleDescriptions()
        elif groupName == "Html":
            styles = HtmlLexer.styleDescriptions()

        self.propertyListWidget.clear()
        for i in styles:
            self.propertyListWidget.addItem(i)
        self.propertyListWidget.setCurrentRow(0)
Esempio n. 4
0
    def loadStyle(self, styleName, groupName):
        if styleName == "Default":
            if groupName == "Python":
                return PythonLexer.defaultStyle()
            elif groupName == "Css":
                return CssLexer.defaultStyle()
            elif groupName == "Xml":
                return XmlLexer.defaultStyle()
            elif groupName == "Html":
                return HtmlLexer.defaultStyle()
        else:
            pass

        style = {}

        stylePath = os.path.join(self.useData.appPathDict["stylesdir"],
                                 groupName, styleName + ".xml")
        dom_document = QtXml.QDomDocument()
        file = open(stylePath, "r")
        x = dom_document.setContent(file.read())
        file.close()

        rootElement = dom_document.documentElement()
        lexerElement = rootElement.firstChild().toElement()
        node = lexerElement.firstChild()

        while node.isNull() is False:
            tag = node.toElement()

            name = tag.text()
            font = tag.attribute("font")
            color = tag.attribute("color")
            size = int(tag.attribute("size"))
            bold = (tag.attribute("bold") == "True")
            italic = (tag.attribute("italic") == "True")
            paper = tag.attribute("paper")

            style[name] = [font, color, size, bold, italic, paper]

            node = node.nextSibling()
        return style
Esempio n. 5
0
    def loadStyle(self, styleName, groupName):
        if styleName == "Default":
            if groupName == "Python":
                return PythonLexer.defaultStyle()
            elif groupName == "Css":
                return CssLexer.defaultStyle()
            elif groupName == "Xml":
                return XmlLexer.defaultStyle()
            elif groupName == "Html":
                return HtmlLexer.defaultStyle()
        else:
            pass

        style = {}

        stylePath = os.path.join(self.useData.appPathDict["stylesdir"],
                                 groupName, styleName + ".xml")
        dom_document = QtXml.QDomDocument()
        file = open(stylePath, "r")
        x = dom_document.setContent(file.read())
        file.close()

        rootElement = dom_document.documentElement()
        lexerElement = rootElement.firstChild().toElement()
        node = lexerElement.firstChild()

        while node.isNull() is False:
            tag = node.toElement()

            name = tag.text()
            font = tag.attribute("font")
            color = tag.attribute("color")
            size = int(tag.attribute("size"))
            bold = (tag.attribute("bold") == "True")
            italic = (tag.attribute("italic") == "True")
            paper = tag.attribute("paper")

            style[name] = [font, color, size, bold, italic, paper]

            node = node.nextSibling()
        return style