def __init__(self, parent):
        QPlainTextEdit.__init__(self, parent)

        # Use the default theme from the book editor
        theme = get_theme(None)
        self.line_number_palette = pal = QPalette()
        pal.setColor(QPalette.ColorRole.Base, theme_color(theme, 'LineNr', 'bg'))
        pal.setColor(QPalette.ColorRole.Text, theme_color(theme, 'LineNr', 'fg'))
        pal.setColor(QPalette.ColorRole.BrightText, theme_color(theme, 'LineNrC', 'fg'))

        self.line_number_area = LineNumberArea(self)

        self.blockCountChanged.connect(self.update_line_number_area_width)
        self.updateRequest.connect(self.update_line_number_area)
        self.cursorPositionChanged.connect(self.highlight_cursor_line)

        self.update_line_number_area_width(0)
        self.highlight_cursor_line()
        self.clicked_line_numbers = set()
示例#2
0
 def __init__(self, parent=None):
     QPlainTextEdit.__init__(self, parent)
     self.syntax = None