Пример #1
0
    def paint_it(self, color, match_position, length, start_position,
                 end_position):
        '''
            This is where the actual coloring takes place.
            Color, the position of the first character and
            the length of the text to be colored must be provided.
            Coloring occurs only if the character at the current position
            has not a style from the excluded styles list assigned.

            Args:
                color = integer, expected in range of 0-16777215
                match_position = integer,  denotes the start position of a match
                length = integer, denotes how many chars need to be colored.
                start_position = integer,  denotes the start position of the visual area
                end_position = integer,  denotes the end position of the visual area
            Returns:
                None
        '''
        if (match_position + length < start_position
                or match_position > end_position
                or editor.getStyleAt(match_position) in self.excluded_styles):
            return

        editor.setIndicatorCurrent(0)
        editor.setIndicatorValue(color)
        editor.indicatorFillRange(match_position, length)
Пример #2
0
 def paint_it(indicator, pos, length):
     current_line = editor.lineFromPosition(pos)
     line_start_position = editor.positionFromLine(current_line)
     text = editor.getLine(current_line)
     found_comment_char = text.find('#')
     relative_line_position = pos - line_start_position
     if ((-1 < found_comment_char < relative_line_position)
             or (text.count('"', 0, relative_line_position) % 2 == 1)
             or (text.count("'", 0, relative_line_position) % 2 == 1)):
         return
     else:
         editor.setIndicatorCurrent(indicator)
         editor.indicatorFillRange(pos, length)
 def paint_it(indicator, pos, length):
     current_line = editor.lineFromPosition(pos)
     line_start_position = editor.positionFromLine(current_line)
     text = editor.getLine(current_line)
     found_comment_char = text.find('#')
     relative_line_position = pos-line_start_position
     if((-1 < found_comment_char < relative_line_position) or
        (text.count('"', 0, relative_line_position) % 2 == 1) or
        (text.count("'", 0, relative_line_position) % 2 == 1)):
         return
     else:
         editor.setIndicatorCurrent(indicator)
         editor.indicatorFillRange(pos,length)
Пример #4
0
 def paint_it(indicator, pos, length):
     current_line = editor.lineFromPosition(pos)
     editor.setIndicatorCurrent(indicator)
     editor.indicatorFillRange(pos, length)