def __init__(self, document): """Create the View for the given document.""" super(View, self).__init__() # to enable mouseMoveEvent to display tooltip super(View, self).setMouseTracking(True) self.setDocument(document) self.setLineWrapMode(QPlainTextEdit.NoWrap) self.setCursorWidth(2) # restore saved cursor position (defaulting to 0) document.loaded.connect(self.restoreCursor) document.loaded.connect(self.setTabWidth) document.closed.connect(self.slotDocumentClosed) self.textChanged.connect(self.invalidateCurrentBlock) variables.manager(document).changed.connect(self.setTabWidth) self.restoreCursor() app.settingsChanged.connect(self.readSettings) self.readSettings() # will also call updateCursor # line wrap preference is only read on init wrap = QSettings().value("view_preferences/wrap_lines", False, bool) self.setLineWrapMode( QPlainTextEdit.WidgetWidth if wrap else QPlainTextEdit.NoWrap) self.installEventFilter(cursorkeys.handler) self.toolTipInfo = [] self.block_at_mouse = None self.include_target = [] app.viewCreated(self)
def __init__(self, document): """Create the View for the given document.""" super(View, self).__init__() # to enable mouseMoveEvent to display tooltip super(View, self).setMouseTracking(True) self.setDocument(document) self.setLineWrapMode(QPlainTextEdit.NoWrap) self.setCursorWidth(2) # restore saved cursor position (defaulting to 0) document.loaded.connect(self.restoreCursor) document.loaded.connect(self.setTabWidth) document.closed.connect(self.slotDocumentClosed) self.textChanged.connect(self.invalidateCurrentBlock) variables.manager(document).changed.connect(self.setTabWidth) self.restoreCursor() app.settingsChanged.connect(self.readSettings) self.readSettings() # will also call updateCursor # line wrap preference is only read on init wrap = QSettings().value("view_preferences/wrap_lines", False, bool) self.setLineWrapMode(QPlainTextEdit.WidgetWidth if wrap else QPlainTextEdit.NoWrap) self.installEventFilter(cursorkeys.handler) self.toolTipInfo = [] self.block_at_mouse = None self.include_target = [] app.viewCreated(self)
def __init__(self, document): """Creates the View for the given document.""" super(View, self).__init__() self.setDocument(document) self.setLineWrapMode(QPlainTextEdit.NoWrap) self.setCursorWidth(2) # restore saved cursor position (defaulting to 0) document.loaded.connect(self.restoreCursor) document.loaded.connect(self.setTabWidth) document.closed.connect(self.slotDocumentClosed) variables.manager(document).changed.connect(self.setTabWidth) self.restoreCursor() app.settingsChanged.connect(self.readSettings) self.readSettings() # will also call updateCursor app.viewCreated(self)
def __init__(self, document): """Creates the View for the given document.""" super(View, self).__init__() self.setDocument(document) self.setLineWrapMode(QPlainTextEdit.NoWrap) self.setCursorWidth(2) # restore saved cursor position (defaulting to 0) document.loaded.connect(self.restoreCursor) document.loaded.connect(self.setTabWidth) document.closed.connect(self.slotDocumentClosed) variables.manager(document).changed.connect(self.setTabWidth) self.restoreCursor() app.settingsChanged.connect(self.readSettings) self.readSettings() # will also call updateCursor # line wrap preference is only read on init wrap = QSettings().value("view_preferences/wrap_lines", False, bool) self.setLineWrapMode(QPlainTextEdit.WidgetWidth if wrap else QPlainTextEdit.NoWrap) app.viewCreated(self)
def __init__(self, document): """Creates the View for the given document.""" super(View, self).__init__() self.setDocument(document) self.setLineWrapMode(QPlainTextEdit.NoWrap) self.setCursorWidth(2) # restore saved cursor position (defaulting to 0) document.loaded.connect(self.restoreCursor) document.loaded.connect(self.setTabWidth) document.closed.connect(self.slotDocumentClosed) variables.manager(document).changed.connect(self.setTabWidth) self.restoreCursor() app.settingsChanged.connect(self.readSettings) self.readSettings() # will also call updateCursor # line wrap preference is only read on init wrap = QSettings().value("view_preferences/wrap_lines", False, bool) self.setLineWrapMode( QPlainTextEdit.WidgetWidth if wrap else QPlainTextEdit.NoWrap) app.viewCreated(self)