Table of Contents

Class: Editor eric3/QScintilla/Editor.py

Class implementing the editor component of the eric3 IDE.

Signals

modificationStatusChanged(boolean, editor)
emitted when the modification status has changed
cursorChanged(string, int, int)
emitted when the cursor position was changed
editorSaved(string)
emitted after the editor has been saved
captionChanged(string, editor)
emitted when the caption is updated. Typically due to a readOnly attribute change.
breakpointToggled(editor)
emitted when a breakpoint is toggled
bookmarkToggled(editor)
emitted when a bookmark is toggled
Base Classes   
QextScintilla
Methods   
__init__
_updateReadOnly
bindLexer
boxCommentLine
boxCommentLineOrSelection
boxCommentSelection
checkDirty
clearBreakpoint
close
closeIt
commentLine
commentLineOrSelection
commentSelection
contextMenuEvent
curLineHasBreakpoint
ensureVisible
eventFilter
focusInEvent
focusOutEvent
getBookmarks
getBreakpoints
getExtension
getFileName
getHighlightPosition
getLexer
getMacroName
getZoom
gotoLine
handleBookmark
handleClearBookmarks
handleClearBreakpoints
handleCodeCoverage
handleCodeMetrics
handleContextClose
handleContextSave
handleContextSaveAs
handleCursorPositionChanged
handleDeleteMacro
handleDeselectAll
handleEditBreakpoint
handleLMBbookmarks
handleLMBbreakpoints
handleLanguage
handleLoadMacro
handleMarginClicked
handleModificationChanged
handleModificationReadOnly
handleNextBookmark
handleNextBreakpoint
handlePreviousBookmark
handlePreviousBreakpoint
handleProfileData
handleRunMacro
handleSaveMacro
handleSelectAll
handleShowContextMenu
handleShowMarginContextMenu
handleShowShowMenu
handleStartMacroRecording
handleStopMacroRecording
handleSyntaxCheck
handleTabnanny
handleTemporaryBreakpoint
handleToggleBookmark
handleToggleBreakpoint
handleToggleBreakpointEnabled
hasBookmarks
hasBreakpoints
highlight
highlightVisible
indentLine
indentLineOrSelection
indentSelection
initContextMenu
initContextMenuChecks
initContextMenuLanguages
initContextMenuShow
initMarginContextMenu
lineAt
marginsWidth
newBreakpointWithProperties
printFile
printSelection
readFile
readSettings
refresh
revertToUnmodified
saveFile
saveFileAs
setAutoCompletion
setBreakpointIgnoreCount
setBreakpointProperties
setCallTips
setLanguage
setLineMarkerColours
setMargin0and2
setTextDisplay
streamCommentLine
streamCommentLineOrSelection
streamCommentSelection
toggleBreakpoint
toggleBreakpointEnabled
uncommentLine
uncommentLineOrSelection
uncommentSelection
unindentLineOrSelection
writeFile
zoomIn
zoomOut
zoomTo
  __init__ 
__init__ (
        self,
        dbs,
        fn=None,
        parent=None,
        name=None,
        flags=0,
        )

Constructor

Arguments

dbs
reference to the debug server object
fn
name of the file to be opened (string). If it is None, a new (empty) editor is opened
parent
parent widget (viewmanager) of this editor (QWidget)
name
name of this editor (string or QString)
flags
window flags
  _updateReadOnly 
_updateReadOnly ( self,  bForce=1 )

Private method to update the readOnly information for this editor.

If bForce is True, then updates everything regardless if the attributes have actually changed, such as during initialization time. A signal is emitted after the caption change.

Arguments

bForce
1 to force change, 0 to only update and emit signal if there was an attribute change.
  bindLexer 
bindLexer ( self,  language )

Private slot to set the correct lexer depending on language.

Arguments

language
language (extension) of the desired lexer (string)
  boxCommentLine 
boxCommentLine ( self )

Public slot to box comment the current line.

  boxCommentLineOrSelection 
boxCommentLineOrSelection ( self )

Public slot to box comment the current line or current selection.

  boxCommentSelection 
boxCommentSelection ( self )

Public slot to box comment the current selection.

  checkDirty 
checkDirty ( self )

Private method to check dirty status and open a message window.

Returns

flag indicating successful reset of the dirty flag (boolean)

  clearBreakpoint 
clearBreakpoint ( self,  line )

Public method to clear a breakpoint.

Note: This doesn't clear the breakpoint in the debugger, it just deletes it from the editor internal list of breakpoints.

Arguments

line
linenumber of the breakpoint
  close 
close ( self,  alsoDelete=0 )

Public method called when the window gets closed.

This overwritten method redirects the action to our ViewManager.closeEditor, which in turn calls our closeIt method.

Arguments

alsoDelete
ignored
  closeIt 
closeIt ( self )

Public method called by the viewmanager to finally get rid of us.

  commentLine 
commentLine ( self )

Public slot to comment the current line.

  commentLineOrSelection 
commentLineOrSelection ( self )

Public slot to comment the current line or current selection.

  commentSelection 
commentSelection ( self )

Public slot to comment the current selection.

  contextMenuEvent 
contextMenuEvent ( self,  evt )

Private method implementing the context menu event.

Arguments

evt
the context menu event (QContextMenuEvent)
  curLineHasBreakpoint 
curLineHasBreakpoint ( self )

Public method to check for the presence of a breakpoint at the current line.

Returns

flag indicating the presence of a breakpoint (boolean)

  ensureVisible 
ensureVisible ( self,  line )

Public slot to ensure, that the specified line is visible.

Arguments

line
line number to make visible
  eventFilter 
eventFilter (
        self,
        object,
        event,
        )

Private method called to filter an event.

Arguments:

object
object, that generated the event (QObject)
event
the event, that was generated by object (QEvent)

Returns:

flag indicating if event was filtered out

  focusInEvent 
focusInEvent ( self,  event )

Public method called when the editor receives focus.

Arguments

event
the event object (QFocusEvent)
  focusOutEvent 
focusOutEvent ( self,  event )

Public method called when the editor loses focus.

Arguments

event
the event object (QFocusEvent)
  getBookmarks 
getBookmarks ( self )

Public method to retrieve the bookmarks.

Returns

sorted list of all lines containing a bookmark (list of integer)

  getBreakpoints 
getBreakpoints ( self )

Public method to retrieve all breakpoints.

This method will update the internal list of breakpoints before the list is returned.

Returns

a list of tuples with linenumber and condition

  getExtension 
getExtension ( self,  fname )

Private method to get the fileextension without a leading ..

Arguments

fname
filename (string)

Returns

extension of the filename (string)

  getFileName 
getFileName ( self )

Public method to return the name of the file being displayed.

Returns

filename of the displayed file (string)

  getHighlightPosition 
getHighlightPosition ( self )

Public method to return the position of the highlight bar.

Returns

line number of the highlight bar

  getLexer 
getLexer ( self )

Public method to retrieve a reference to the lexer object.

Returns

the lexer object (Lexer)

  getMacroName 
getMacroName ( self )

Private method to select a macro name from the list of macros.

Returns

Tuple of macro name and a flag, indicating, if the user pressed ok or canceled the operation. (QString, boolean)

  getZoom 
getZoom ( self )

Public method used to retrieve the current zoom factor.

Returns

zoom factor (int)

  gotoLine 
gotoLine ( self,  line )

Public slot to jump to the beginning of a line.

Arguments

line
line number to go to
  handleBookmark 
handleBookmark ( self,  line )

Public method to toggle a bookmark.

Arguments

line
line number of the bookmark
  handleClearBookmarks 
handleClearBookmarks ( self )

Private slot to handle the Clear all bookmarks context menu action.

  handleClearBreakpoints 
handleClearBreakpoints ( self )

Private slot to handle the Clear all breakpoints context menu action.

  handleCodeCoverage 
handleCodeCoverage ( self )

Private method to handle the code coverage context menu action.

  handleCodeMetrics 
handleCodeMetrics ( self )

Private method to handle the code metrics context menu action.

  handleContextClose 
handleContextClose ( self )

Private slot handling the close context menu entry.

  handleContextSave 
handleContextSave ( self )

Private slot handling the save context menu entry.

  handleContextSaveAs 
handleContextSaveAs ( self )

Private slot handling the save as context menu entry.

  handleCursorPositionChanged 
handleCursorPositionChanged (
        self,
        line,
        pos,
        )

Private slot to handle the cursorPositionChanged signal.

It emits the signal cursorChanged with parameters fileName, line and pos.

Arguments

line
line number of the cursor
pos
position in line of the cursor
  handleDeleteMacro 
handleDeleteMacro ( self )

Public method to delete a macro.

  handleDeselectAll 
handleDeselectAll ( self )

Private slot handling the deselect all context menu action.

  handleEditBreakpoint 
handleEditBreakpoint ( self )

Private slot to handle the Edit breakpoint context menu action.

  handleLMBbookmarks 
handleLMBbookmarks ( self )

Private method to handle the LMB toggles bookmark context menu action.

  handleLMBbreakpoints 
handleLMBbreakpoints ( self )

Private method to handle the LMB toggles breakpoint context menu action.

  handleLanguage 
handleLanguage ( self,  idx )

Private method to handle the selection of a lexer language.

Arguments

idx
index of the lexer language (int)
  handleLoadMacro 
handleLoadMacro ( self )

Public method to load a macro from a file.

  handleMarginClicked 
handleMarginClicked (
        self,
        margin,
        line,
        state,
        )

Private slot to handle the marginClicked signal.

Arguments

margin
id of the clicked margin
line
line number pf the click
state
mouse button state
  handleModificationChanged 
handleModificationChanged ( self,  m )

Private slot to handle the modificationChanged signal.

It emits the signal modificationStatusChanged with parameters m and self.

Arguments

m
modification status
  handleModificationReadOnly 
handleModificationReadOnly ( self )

Private slot to handle the modificationAttempted signal.

  handleNextBookmark 
handleNextBookmark ( self )

Private slot to handle the Next bookmark context menu action.

  handleNextBreakpoint 
handleNextBreakpoint ( self )

Private slot to handle the Next breakpoint context menu action.

  handlePreviousBookmark 
handlePreviousBookmark ( self )

Private slot to handle the Previous bookmark context menu action.

  handlePreviousBreakpoint 
handlePreviousBreakpoint ( self )

Private slot to handle the Previous breakpoint context menu action.

  handleProfileData 
handleProfileData ( self )

Private method to handle the show profile data context menu action.

  handleRunMacro 
handleRunMacro ( self )

Public method to execute a macro.

  handleSaveMacro 
handleSaveMacro ( self )

Public method to save a macro to a file.

  handleSelectAll 
handleSelectAll ( self )

Private slot handling the select all context menu action.

  handleShowContextMenu 
handleShowContextMenu ( self )

Private slot handling the aboutToShow signal of the context menu.

  handleShowMarginContextMenu 
handleShowMarginContextMenu ( self )

Private slot handling the aboutToShow signal of the margins context menu.

  handleShowShowMenu 
handleShowShowMenu ( self )

Private slot called before the show menu is shown.

  handleStartMacroRecording 
handleStartMacroRecording ( self )

Public method to start macro recording.

  handleStopMacroRecording 
handleStopMacroRecording ( self )

Public method to stop macro recording.

  handleSyntaxCheck 
handleSyntaxCheck ( self )

Private method to handle the syntax check context menu action.

  handleTabnanny 
handleTabnanny ( self )

Private method to handle the tabnanny context menu action.

  handleTemporaryBreakpoint 
handleTemporaryBreakpoint ( self )

  handleToggleBookmark 
handleToggleBookmark ( self )

Private slot to handle the Toggle bookmark context menu action.

  handleToggleBreakpoint 
handleToggleBreakpoint ( self )

Private slot to handle the Toggle breakpoint context menu action.

  handleToggleBreakpointEnabled 
handleToggleBreakpointEnabled ( self )

Private slot to handle the Enable/Disable breakpoint context menu action.

  hasBookmarks 
hasBookmarks ( self )

Public method to check for the presence of bookmarks.

Returns

flag indicating the presence of bookmarks (boolean)

  hasBreakpoints 
hasBreakpoints ( self )

Public method to check for the presence of breakpoints.

Returns

flag indicating the presence of breakpoints (boolean)

  highlight 
highlight (
        self,
        line=None,
        error=0,
        )

Public method to highlight (or de-highlight) a particular line.

Arguments

line
line number to highlight
error
flag indicating whether the error highlight should be used
  highlightVisible 
highlightVisible ( self )

Public method to make sure that the highlight is visible.

  indentLine 
indentLine ( self,  indent=1 )

Private method to indent or unindent the current line.

Arguments

indent
flag indicating an indent operation If the flag is true, an indent operation is performed. Otherwise the current line is unindented.
  indentLineOrSelection 
indentLineOrSelection ( self )

Public slot to indent the current line or current selection

  indentSelection 
indentSelection ( self,  indent=1 )

Private method to indent or unindent the current selection.

Arguments

indent
flag indicating an indent operation If the flag is true, an indent operation is performed. Otherwise the current line is unindented.
  initContextMenu 
initContextMenu ( self )

Private method used to setup the context menu

  initContextMenuChecks 
initContextMenuChecks ( self )

Private method used to setup the Checks context sub menu.

  initContextMenuLanguages 
initContextMenuLanguages ( self )

Private method used to setup the Languages context sub menu.

  initContextMenuShow 
initContextMenuShow ( self )

Private method used to setup the Show context sub menu.

  initMarginContextMenu 
initMarginContextMenu ( self )

Private method used to setup the context menu for the margins

  lineAt 
lineAt ( self,  pos )

Public method to calculate the line at a position.

This variant is able to calculate the line for positions in the margins and for empty lines.

Arguments

pos
position to calculate the line for (QPoint)

Returns

linenumber at position or -1, if there is no line at pos (integer, zero based)

  marginsWidth 
marginsWidth ( self )

Private method to determin the width of all margins.

Returns

width of all margins in pixels (integer)

  newBreakpointWithProperties 
newBreakpointWithProperties (
        self,
        line,
        properties,
        )

Public method to set a new breakpoint and its properties.

Arguments

line
line number of the breakpoint
properties
properties for the breakpoint (tuple) (condition, temporary flag, enabled flag, ignore count)
  printFile 
printFile ( self )

Public slot to print the text.

  printSelection 
printSelection ( self )

Public slot to print the selected text.

  readFile 
readFile ( self,  fn )

Public slot to read the text from a file.

Arguments

fn
filename to read from (string or QString)
  readSettings 
readSettings ( self )

Public slot to read the settings into our lexer.

  refresh 
refresh ( self )

Public slot to refresh the editor contents.

  revertToUnmodified 
revertToUnmodified ( self )

Private method to revert back to the last saved state.

  saveFile 
saveFile (
        self,
        saveas=0,
        path=None,
        )

Public slot to save the text to a file.

Arguments

saveas
flag indicating a save as action
path
directory to save the file in (string or QString)

Returns

tuple of two values (boolean, string) giving a success indicator and the name of the saved file

  saveFileAs 
saveFileAs ( self,  path=None )

Public slot to save a file with a new name.

saveas
flag indicating a save as action
path
directory to save the file in (string or QString)

Returns

tuple of two values (boolean, string) giving a success indicator and the name of the saved file

  setAutoCompletion 
setAutoCompletion ( self )

Private method to configure the autocompletion function.

  setBreakpointIgnoreCount 
setBreakpointIgnoreCount (
        self,
        line,
        count,
        )

Public method to set a breakpoints ignore count.

Arguments

line
line number of the breakpoint
count
ignore count for the breakpoint (integer)
  setBreakpointProperties 
setBreakpointProperties (
        self,
        line,
        properties,
        )

Public method to set a breakpoints properties.

Arguments

line
line number of the breakpoint
properties
properties for the breakpoint (tuple) (condition, temporary flag, enabled flag, ignore count)
  setCallTips 
setCallTips ( self )

Private method to configure the calltips function.

  setLanguage 
setLanguage ( self,  language )

Private method to set a lexer language.

Arguments

language
language (extension) of the desired lexer (string)
  setLineMarkerColours 
setLineMarkerColours ( self )

Private method to set the line marker colours.

  setMargin0and2 
setMargin0and2 ( self )

Private method to configure margins 0 and 2.

  setTextDisplay 
setTextDisplay ( self )

Private method to configure the text display.

  streamCommentLine 
streamCommentLine ( self )

Public slot to stream comment the current line.

  streamCommentLineOrSelection 
streamCommentLineOrSelection ( self )

Public slot to stream comment the current line or current selection.

  streamCommentSelection 
streamCommentSelection ( self )

Public slot to comment the current selection.

  toggleBreakpoint 
toggleBreakpoint (
        self,
        line,
        temporary=0,
        )

Public method to toggle a breakpoint.

Arguments

line
line number of the breakpoint
temporary
flag indicating a temporary breakpoint
  toggleBreakpointEnabled 
toggleBreakpointEnabled ( self,  line )

Public method to toggle a breakpoints enabled status.

Arguments

line
line number of the breakpoint
  uncommentLine 
uncommentLine ( self )

Public slot to uncomment the current line.

This happens only, if it was commented by using the commentLine() or commentSelection() slots

  uncommentLineOrSelection 
uncommentLineOrSelection ( self )

Public slot to uncomment the current line or current selection.

This happens only, if it was commented by using the commentLine() or commentSelection() slots

  uncommentSelection 
uncommentSelection ( self )

Public slot to uncomment the current selection.

This happens only, if it was commented by using the commentLine() or commentSelection() slots

  unindentLineOrSelection 
unindentLineOrSelection ( self )

Public slot to unindent the current line or current selection.

  writeFile 
writeFile ( self,  fn )

Public slot to write the text to a file.

Arguments

fn
filename to write to (string or QString)

Returns

flag indicating success

  zoomIn 
zoomIn ( self,  zoom=1 )

Public method used to increase the zoom factor.

Arguments

zoom
zoom factor increment
  zoomOut 
zoomOut ( self,  zoom=1 )

Public method used to decrease the zoom factor.

Arguments

zoom
zoom factor decrement
  zoomTo 
zoomTo ( self,  zoom )

Public method used to zoom to a specific zoom factor.

Arguments

zoom
zoom factor

Table of Contents

This document was automatically generated by HappyDoc version 2.1