Esempio n. 1
0
    def __init__(self, parent=None):

        QsciLexerPython.__init__(self, parent)
        Lexer.__init__(self)

        self.commentString = "#"
        return
Esempio n. 2
0
    def __init__( self, parent = None ):

        QsciLexerPython.__init__( self, parent )
        Lexer.__init__( self )

        self.commentString = "#"
        return
Esempio n. 3
0
 def __init__(self, colorStyle, parent=None):
     QsciLexerPython.__init__(self, parent)
     # self.parent = parent
     # self.sci = self.parent
     self.colorStyle = colorStyle
     self.plainFont = QFont()
     self.plainFont.setFamily(fontName)
     self.plainFont.setFixedPitch(True)
     self.plainFont.setPointSize(fontSize)
     self.marginFont = QFont()
     self.marginFont.setPointSize(10)
     self.marginFont.setFamily("MS Dlg")
     self.boldFont = QFont(self.plainFont)
     self.boldFont.setBold(True)
     """    
     enum {
       Default = 0, Comment = 1, Number = 2,
       DoubleQuotedString = 3, SingleQuotedString = 4, Keyword = 5,
       TripleSingleQuotedString = 6, TripleDoubleQuotedString = 7, ClassName = 8,
       FunctionMethodName = 9, Operator = 10, Identifier = 11,
       CommentBlock = 12, UnclosedString = 13, HighlightedIdentifier = 14,
       Decorator = 15
     }
     enum IndentationWarning {
       NoWarning = 0, Inconsistent = 1, TabsAfterSpaces = 2,
       Spaces = 3, Tabs = 4
     } 
     """
     self.styles = [
         # index description color paper font eol
         QsciStyle(0, QString("base"), self.colorStyle.color, self.colorStyle.paper, self.plainFont, True),
         QsciStyle(1, QString("comment"), QColor("#008000"), self.colorStyle.paper, self.plainFont, True),
         QsciStyle(2, QString("number"), QColor("#008000"), self.colorStyle.paper, self.boldFont, False),
         QsciStyle(3, QString("DoubleQuotedString"), QColor("#008000"), self.colorStyle.paper, self.plainFont, True),
         QsciStyle(4, QString("SingleQuotedString"), QColor("#008000"), self.colorStyle.paper, self.plainFont, True),
         QsciStyle(5, QString("Keyword"), QColor("#000000"), self.colorStyle.paper, self.boldFont, True),
         QsciStyle(
             6, QString("TripleSingleQuotedString"), QColor("#ffd0d0"), self.colorStyle.paper, self.plainFont, True
         ),
         QsciStyle(
             7, QString("TripleDoubleQuotedString"), QColor("#001111"), self.colorStyle.paper, self.plainFont, False
         ),
         QsciStyle(8, QString("ClassName"), QColor("#000000"), self.colorStyle.paper, self.plainFont, False),
         QsciStyle(
             9, QString("FunctionMethodName"), QColor("#000000"), self.colorStyle.paper, self.plainFont, False
         ),
         QsciStyle(10, QString("Operator"), QColor("#ff00ff"), self.colorStyle.paper, self.plainFont, False),
         QsciStyle(11, QString("Identifier"), QColor("#000000"), self.colorStyle.paper, self.plainFont, False),
         QsciStyle(12, QString("CommentBlock"), QColor("#000000"), self.colorStyle.paper, self.plainFont, False),
         QsciStyle(13, QString("UnclosedString"), QColor("#010101"), self.colorStyle.paper, self.plainFont, False),
         QsciStyle(
             14, QString("HighlightedIdentifier"), QColor("#0000ff"), self.colorStyle.paper, self.plainFont, False
         ),
         QsciStyle(15, QString("Decorator"), QColor("#ff00ff"), self.colorStyle.paper, self.plainFont, False)
         # QsciStyle(7, QString("MultiComment_start"), QColor("#ff00ff"), QColor("#001111"), self.plainFont, False),
         # QsciStyle(8, QString("MultiComment"), QColor("#ff00ff"), QColor("#001111"), self.plainFont, False),
         # QsciStyle(9, QString("MultiComment_stop"), QColor("#ff00ff"), QColor("#001111"), self.plainFont, False)
     ]
     self._foldcompact = True
Esempio n. 4
0
 def __init__(self, parent):
     QsciLexerPython.__init__(self, parent)
     self.parent = parent
     self.plainFont = QFont()
     self.plainFont.setFamily(config.fontName())
     self.plainFont.setFixedPitch(True)
     self.plainFont.setPointSize(config.fontSize())
     self.boldFont = QFont(self.plainFont)
     self.boldFont.setBold(True)
     self.setFoldCompact(True)
 def __init__(self, parent=None):
     """
     Constructor
     
     @param parent parent widget of this lexer
     """
     QsciLexerPython.__init__(self, parent)
     Lexer.__init__(self)
     
     self.commentString = QString("#")
Esempio n. 6
0
    def __init__(self, font):
        """
		Constructor

		Arguments:
		font -- a QFont
		"""

        QsciLexerPython.__init__(self)
        self.setDefaultFont(font)
        self.setIndentationWarning(self.Inconsistent)
Esempio n. 7
0
	def __init__(self, font):

		"""
		Constructor

		Arguments:
		font -- a QFont
		"""

		QsciLexerPython.__init__(self)
		self.setDefaultFont(font)
		self.setIndentationWarning(self.Inconsistent)
Esempio n. 8
0
    def __init__(self, parent):
        QsciLexerPython.__init__(self, parent)
        
        self.lexer = Lexer.Lexer(self.language())

        self.setDefaultPaper(self.lexer.get_globaldefault_paper())
        self.setFont(self.lexer.get_default_font())
        self.setIndentationWarning(QsciLexerPython.Inconsistent)
        self.apiwords = self.lexer.api_words.split('\n')

        api = PyQt4.Qsci.QsciAPIs(self)
        for word in self.apiwords:
            api.add(word)
        api.prepare()

        self.comment_string = QString("#")
        self.stream_comment_string = {
            'start' : QString(''),
            'end'   : QString('')
        }
Esempio n. 9
0
    def __init__(self, parent=None):
        self.__styles = {
            QsciLexerPython.Default: "text",
            QsciLexerPython.Comment: "comment",
            QsciLexerPython.Number: "def:number",
            QsciLexerPython.DoubleQuotedString: "def:string",
            QsciLexerPython.SingleQuotedString: "def:string",
            QsciLexerPython.Keyword: "def:keyword",
            QsciLexerPython.TripleSingleQuotedString: "def:string",
            QsciLexerPython.TripleDoubleQuotedString: "def:string",
            QsciLexerPython.ClassName: "def:function",
            QsciLexerPython.FunctionMethodName: "def:function",
            QsciLexerPython.Operator: "def:specials",
            QsciLexerPython.Identifier: "text",
            QsciLexerPython.CommentBlock: "comment",
            QsciLexerPython.UnclosedString: "def:error",
            QsciLexerPython.HighlightedIdentifier: "text",
            QsciLexerPython.Decorator: "def:specials",
        }

        BaseLexer.__init__(self)
        QsciLexerPython.__init__(self, parent)
Esempio n. 10
0
    def __init__(self, parent=None):
        self.__styles = {
            QsciLexerPython.Default: "text",
            QsciLexerPython.Comment: "comment",
            QsciLexerPython.Number: "def:number",
            QsciLexerPython.DoubleQuotedString: "def:string",
            QsciLexerPython.SingleQuotedString: "def:string",
            QsciLexerPython.Keyword: "def:keyword",
            QsciLexerPython.TripleSingleQuotedString: "def:string",
            QsciLexerPython.TripleDoubleQuotedString: "def:string",
            QsciLexerPython.ClassName: "def:function",
            QsciLexerPython.FunctionMethodName: "def:function",
            QsciLexerPython.Operator: "def:specials",
            QsciLexerPython.Identifier: "text",
            QsciLexerPython.CommentBlock: "comment",
            QsciLexerPython.UnclosedString: "def:error",
            QsciLexerPython.HighlightedIdentifier: "text",
            QsciLexerPython.Decorator: "def:specials",
        }

        BaseLexer.__init__(self)
        QsciLexerPython.__init__(self, parent)
Esempio n. 11
0
    def __init__(self, style, paper):
        QsciLexerPython.__init__(self)

        self.lexerPaper = paper

        for key, attrib in style.items():
            value = propertyID[key]
            self.setColor(QtGui.QColor(attrib[1]), value)
            self.setEolFill(True, value)
            self.setPaper(QtGui.QColor(attrib[5]), value)
            if self.lexerPaper[0] == "Plain":
                self.setPaper(QtGui.QColor(attrib[5]), value)
            else:
                self.setPaper(QtGui.QColor(self.lexerPaper[1]), value)

            font = QtGui.QFont(attrib[0], attrib[2])
            font.setBold(attrib[3])
            font.setItalic(attrib[4])
            self.setFont(font, value)

        if self.lexerPaper[0] == "Plain":
            self.setDefaultPaper(QtGui.QColor("#ffffff"))
        else:
            self.setDefaultPaper(QtGui.QColor(self.lexerPaper[1]))
Esempio n. 12
0
    def __init__(self, style, paper):
        QsciLexerPython.__init__(self)

        self.lexerPaper = paper

        for key, attrib in style.items():
            value = propertyID[key]
            self.setColor(QtGui.QColor(attrib[1]), value)
            self.setEolFill(True, value)
            self.setPaper(QtGui.QColor(attrib[5]), value)
            if self.lexerPaper[0] == "Plain":
                self.setPaper(QtGui.QColor(attrib[5]), value)
            else:
                self.setPaper(QtGui.QColor(self.lexerPaper[1]), value)

            font = QtGui.QFont(attrib[0], attrib[2])
            font.setBold(attrib[3])
            font.setItalic(attrib[4])
            self.setFont(font, value)

        if self.lexerPaper[0] == "Plain":
            self.setDefaultPaper(QtGui.QColor("#ffffff"))
        else:
            self.setDefaultPaper(QtGui.QColor(self.lexerPaper[1]))