예제 #1
0
    def __init__(self, parent=None):
        QsciScintilla.__init__(self, parent)

        # Set the default font
        font = QFont()
        font.setFamily(fontName)
        font.setFixedPitch(True)
        font.setPointSize(fontSize)
        fontmetrics = QFontMetrics(font)

        # Margin 0 is used for line numbers
        self.setMarginsFont(font)
        self.setMarginWidth(1, fontmetrics.width("00000"))
        self.setMarginLineNumbers(1, True)
        #self.setMarginsBackgroundColor(QColor("#cccccc"))

        # Brace matching: enable for a brace immediately before or after the current position
        self.setBraceMatching(QsciScintilla.SloppyBraceMatch)

        # Current line visible with special background color
        self.setCaretLineVisible(True)
        #self.setCaretLineBackgroundColor(caretBackground)

        # Set Python lexer
        self.setLexer(QsciLexerPython())
        # override style settings to the same font and size
        # (python lexer has styles 0 ... 15)
        for i in range(16):
            self.SendScintilla(QsciScintilla.SCI_STYLESETFONT, i,
                               fontName.encode("ascii"))
            self.SendScintilla(QsciScintilla.SCI_STYLESETSIZE, i, fontSize)

        # make the source read-only
        self.SendScintilla(QsciScintilla.SCI_SETREADONLY, True)
예제 #2
0
    def __init__(self, parent=None):
        QsciScintilla.__init__(self, parent)

        self.mylexer = None
        self.api = None

        self.setCommonOptions()
        self.initShortcuts()
예제 #3
0
    def __init__(self, parent=None):
        QsciScintilla.__init__(self, parent)

        self.mylexer = None
        self.api = None

        self.setCommonOptions()
        self.initShortcuts()