Exemple #1
0
    def __init__(self, parent=None):
        TextEditBaseWidget.__init__(self, parent)
                    
        # Indicate occurences of the selected word
        self.connect(self, SIGNAL('cursorPositionChanged(int, int)'),
                     self.__cursor_position_changed)
        self.__find_start = None
        self.__find_end = None
        self.__find_flags = None
        self.SendScintilla(QsciScintilla.SCI_INDICSETSTYLE,
                           self.OCCURENCE_INDICATOR,
                           QsciScintilla.INDIC_BOX)
        self.SendScintilla(QsciScintilla.SCI_INDICSETFORE,
                           self.OCCURENCE_INDICATOR,
                           0x4400FF)

        self.supported_language = None
        self.comment_string = None

        # Mark errors, warnings, ...
        self.markers = []
        self.marker_lines = {}
        self.error = self.markerDefine(QPixmap(get_image_path('error.png'),
                                               'png'))
        self.warning = self.markerDefine(QPixmap(get_image_path('warning.png'),
                                                 'png'))
            
        # Scintilla Python API
        self.api = None
        
        # Mark occurences timer
        self.occurences_timer = QTimer(self)
        self.occurences_timer.setSingleShot(True)
        self.occurences_timer.setInterval(750)
        self.connect(self.occurences_timer, SIGNAL("timeout()"), 
                     self.__mark_occurences)
        
        # Context menu
        self.setup_context_menu()
        
        # Tab key behavior
        self.tab_indents = None
        self.tab_mode = True # see QsciEditor.set_tab_mode
Exemple #2
0
    def __init__(self, parent=None):
        TextEditBaseWidget.__init__(self, parent)
        
        # Do not remove the following attribut (compat. with QtEditor)
        self.highlighter = None
        
        self.eol_mode = None

        # Code analysis markers: errors, warnings
        self.ca_markers = []
        self.ca_marker_lines = {}
        self.error = self.markerDefine(QPixmap(get_image_path('error.png'),
                                               'png'))
        self.warning = self.markerDefine(QPixmap(get_image_path('warning.png'),
                                                 'png'))
        
        # Todo finder
        self.todo_lines = {}
        self.todo_markers = []
        self.todo = self.markerDefine(QPixmap(get_image_path('todo.png'),
                                              'png'))
        
        # Mark occurences timer
        self.occurence_highlighting = None
        self.occurence_timer = QTimer(self)
        self.occurence_timer.setSingleShot(True)
        self.occurence_timer.setInterval(1500)
        self.connect(self.occurence_timer, SIGNAL("timeout()"), 
                     self.__mark_occurences)
        self.occurences = []
        
        # Scrollbar flag area
        self.scrollflagarea_enabled = None
        self.scrollflagarea = ScrollFlagArea(self)
        self.scrollflagarea.hide()
        
        self.setup_editor_args = None
        
        self.document_id = id(self)
                    
        # Indicate occurences of the selected word
        self.connect(self, SIGNAL('cursorPositionChanged(int, int)'),
                     self.__cursor_position_changed)
        self.__find_start = None
        self.__find_end = None
        self.__find_flags = None
        self.SendScintilla(QsciScintilla.SCI_INDICSETSTYLE,
                           self.OCCURENCE_INDICATOR,
                           QsciScintilla.INDIC_BOX)
        self.SendScintilla(QsciScintilla.SCI_INDICSETFORE,
                           self.OCCURENCE_INDICATOR,
                           0x10A000)
        self.SendScintilla(QsciScintilla.SCI_INDICSETSTYLE,
                           self.CA_REFERENCE_INDICATOR,
                           QsciScintilla.INDIC_SQUIGGLE)
        self.SendScintilla(QsciScintilla.SCI_INDICSETFORE,
                           self.CA_REFERENCE_INDICATOR,
                           0x39A2F1)

        self.supported_language = None
        self.classfunc_match = None
        self.comment_string = None
        
        # Current line and find markers
        self.currentline_marker = None
        self.foundline_markers = []
        self.currentline = self.markerDefine(QsciScintilla.Background)
        bcol = CONF.get('editor', 'currentline/backgroundcolor')
        self.setMarkerBackgroundColor(QColor(bcol), self.currentline)
        self.foundline = self.markerDefine(QsciScintilla.Background)
        bcol = CONF.get('editor', 'foundline/backgroundcolor')
        self.setMarkerBackgroundColor(QColor(bcol), self.foundline)

        # Scintilla Python API
        self.api = None
        
        # Context menu
        self.setup_context_menu()
        
        # Tab key behavior
        self.tab_indents = None
        self.tab_mode = True # see QsciEditor.set_tab_mode