(self, data, base=0, offset=None)
Set new Data
Set new Data
Set new Data
def set_data(self, data, base=0, offset=None):
        """ Set new Data
        """
        self.data = data
        self.base = base
        self.adjust()

        if offset is not None:
            self.setFocus()
            self.caret.position = int(ceil(offset))
            self.adjust()
            # scroll position in middle when jump to or something
            line = self.index_to_line(self.caret.position)
            scroll_y = self.verticalScrollBar().value()
            if line >= scroll_y:
                self.verticalScrollBar().setValue(int(line - (self.visible_lines() / 2)))
            if line < scroll_y:
                self.verticalScrollBar().setValue(int(line + (self.visible_lines() / 2)))

            if self._hover_lines:
                self._hovered_line = int(ceil(self.visible_lines() / 2))

            # add a temp attention highlight
            self.add_highlight(HighLight('attention', base + offset, 1))

        self.viewChanged.emit()
def set_data ( self , data , base = 0 , offset = None ) : self . data = data self . base = base self . adjust ( ) if offset is not None : self . setFocus ( ) self . caret . position = int ( ceil ( offset ) ) self . adjust ( ) # scroll position in middle when jump to or something line = self . index_to_line ( self . caret . position ) scroll_y = self . verticalScrollBar ( ) . value ( ) if line >= scroll_y : self . verticalScrollBar ( ) . setValue ( int ( line - ( self . visible_lines ( ) / 2 ) ) ) if line < scroll_y : self . verticalScrollBar ( ) . setValue ( int ( line + ( self . visible_lines ( ) / 2 ) ) ) if self . _hover_lines : self . _hovered_line = int ( ceil ( self . visible_lines ( ) / 2 ) ) # add a temp attention highlight self . add_highlight ( HighLight ( 'attention' , base + offset , 1 ) ) self . viewChanged . emit ( )