Beispiel #1
0
    def _configure_qscintilla(self):
        self._first_visible_line = 0
        self.patFold = re.compile(
            r"(\s)*\"\"\"|(\s)*def |(\s)*class |(\s)*if |(\s)*while |"
            "(\\s)*else:|(\\s)*elif |(\\s)*for |"
            "(\\s)*try:|(\\s)*except:|(\\s)*except |(.)*\\($")
        self.setAutoIndent(True)
        self.setBackspaceUnindents(True)
        self.setCaretLineVisible(True)
        line_color = QColor(
            resources.CUSTOM_SCHEME.get(
                'CurrentLine',
                resources.COLOR_SCHEME['CurrentLine']))
        caretColor = QColor(
            resources.CUSTOM_SCHEME.get(
                'Caret',
                resources.COLOR_SCHEME['Caret']))
        self.setCaretLineBackgroundColor(line_color)
        self.setCaretForegroundColor(caretColor)
        self.setBraceMatching(QsciScintilla.StrictBraceMatch)
        self.SendScintilla(QsciScintilla.SCI_SETBUFFEREDDRAW, 0)
        self.SendScintilla(QsciScintilla.SCI_SETHSCROLLBAR, 0)
        self.setMatchedBraceBackgroundColor(QColor(
            resources.CUSTOM_SCHEME.get(
                'BraceBackground',
                resources.COLOR_SCHEME.get('BraceBackground'))))
        self.setMatchedBraceForegroundColor(QColor(
            resources.CUSTOM_SCHEME.get(
                'BraceForeground',
                resources.COLOR_SCHEME.get('BraceForeground'))))

        self.SendScintilla(QsciScintilla.SCI_INDICSETFORE,
                           self.__indicator_word,
                           int(resources.get_color_hex("SelectedWord"), 16))
        self.SendScintilla(QsciScintilla.SCI_INDICSETSTYLE,
                           self.__indicator_word, 6)
        self.SendScintilla(QsciScintilla.SCI_INDICSETFORE,
                           self.__indicator_folded, int("ffffff", 16))
        self.SendScintilla(QsciScintilla.SCI_INDICSETSTYLE,
                           self.__indicator_folded, 0)
        self._navigation_highlight_active = False
        self.SendScintilla(QsciScintilla.SCI_INDICSETFORE,
                           self.__indicator_navigation,
                           int(resources.get_color_hex("LinkNavigate"), 16))
        self.SendScintilla(QsciScintilla.SCI_INDICSETSTYLE,
                           self.__indicator_navigation, 8)
        self.SendScintilla(QsciScintilla.SCI_INDICSETALPHA,
                           self.__indicator_navigation, 40)

        # Sets QScintilla into unicode mode
        self.SendScintilla(QsciScintilla.SCI_SETCODEPAGE, 65001)
        # Enable multiple selection
        self.SendScintilla(QsciScintilla.SCI_SETMULTIPLESELECTION, 1)
        self.SendScintilla(QsciScintilla.SCI_SETADDITIONALSELECTIONTYPING, 1)
Beispiel #2
0
    def _configure_qscintilla(self):
        self._first_visible_line = 0
        self.patFold = re.compile(
            r"(\s)*\"\"\"|(\s)*def |(\s)*class |(\s)*if |(\s)*while |"
            "(\s)*else:|(\s)*elif |(\s)*for |"
            "(\s)*try:|(\s)*except:|(\s)*except |(.)*\($")
        self.setAutoIndent(True)
        self.setBackspaceUnindents(True)
        self.setCaretLineVisible(True)
        line_color = QColor(
            resources.CUSTOM_SCHEME.get(
                'CurrentLine',
                resources.COLOR_SCHEME['CurrentLine']))
        caretColor = QColor(
            resources.CUSTOM_SCHEME.get(
                'Caret',
                resources.COLOR_SCHEME['Caret']))
        self.setCaretLineBackgroundColor(line_color)
        self.setCaretForegroundColor(caretColor)
        self.setBraceMatching(QsciScintilla.StrictBraceMatch)
        self.SendScintilla(QsciScintilla.SCI_SETBUFFEREDDRAW, 0)
        self.SendScintilla(QsciScintilla.SCI_SETHSCROLLBAR, 0)
        self.setMatchedBraceBackgroundColor(QColor(
            resources.CUSTOM_SCHEME.get(
                'BraceBackground',
                resources.COLOR_SCHEME.get('BraceBackground'))))
        self.setMatchedBraceForegroundColor(QColor(
            resources.CUSTOM_SCHEME.get(
                'BraceForeground',
                resources.COLOR_SCHEME.get('BraceForeground'))))

        self.SendScintilla(QsciScintilla.SCI_INDICSETFORE,
                           self.__indicator_word,
                           int(resources.get_color_hex("SelectedWord"), 16))
        self.SendScintilla(QsciScintilla.SCI_INDICSETSTYLE,
                           self.__indicator_word, 6)
        self.SendScintilla(QsciScintilla.SCI_INDICSETFORE,
                           self.__indicator_folded, int("ffffff", 16))
        self.SendScintilla(QsciScintilla.SCI_INDICSETSTYLE,
                           self.__indicator_folded, 0)
        self._navigation_highlight_active = False
        self.SendScintilla(QsciScintilla.SCI_INDICSETFORE,
                           self.__indicator_navigation,
                           int(resources.get_color_hex("LinkNavigate"), 16))
        self.SendScintilla(QsciScintilla.SCI_INDICSETSTYLE,
                           self.__indicator_navigation, 8)
        self.SendScintilla(QsciScintilla.SCI_INDICSETALPHA,
                           self.__indicator_navigation, 40)

        # Sets QScintilla into unicode mode
        self.SendScintilla(QsciScintilla.SCI_SETCODEPAGE, 65001)
Beispiel #3
0
    def __init__(self, editor):
        QWidget.__init__(self, editor)
        self.__editor = editor
        self.__scrollbar = self.__editor.verticalScrollBar()
        # Configuration
        self.__initialize = False
        self.__background_color = QColor(resources.CUSTOM_SCHEME.get(
            'EditorBackground', resources.COLOR_SCHEME['EditorBackground']))
        self.__transparency = 100
        self.__background_color.setAlpha(self.__transparency)

        self.__selword_color = int(resources.get_color_hex("SelectedWord"), 16)
Beispiel #4
0
    def __init__(self, editor):
        QWidget.__init__(self, editor)
        self.__editor = editor
        self.__scrollbar = self.__editor.verticalScrollBar()
        # Configuration
        self.__initialize = False
        self.__background_color = QColor(
            resources.CUSTOM_SCHEME.get(
                'EditorBackground',
                resources.COLOR_SCHEME['EditorBackground']))
        self.__transparency = 100
        self.__background_color.setAlpha(self.__transparency)

        self.__selword_color = int(resources.get_color_hex("SelectedWord"), 16)