Table of Contents

Class: ViewManager | eric3/ViewManager/ViewManager.py
--- | ---

### Base class inherited by all specific viewmanager classes.

It defines the interface to be implemented by specific viewmanager classes and all common methods.

#### Signals

lastEditorClosed
  emitted after the last editor window was closed
editorOpened(string)
  emitted after an editor window was opened
editorSaved(string)
  emitted after an editor window was saved
checkActions(editor)
  emitted when some actions should be checked for their status
cursorChanged(editor)
  emitted after the cursor position of the active window has changed
breakpointToggled(editor)
  emitted when a breakpoint is toggled.
bookmarkToggled(editor)
  emitted when a bookmark is toggled.

Methods |
--- | ---

__init__
_getOpenStartDir
activeWindow
addSplit
addToRecentList
addView
canCascade
canSplit
canTile
cascade
checkActions
checkAllDirty
checkDirty
closeEditor
closeViewManager
displayPythonFile
editorCommand
editorsCheckFocusInEnabled
enableEditorsCheckFocusIn
eventFilter
focusInEvent
focusOutEvent
getAPIs
getActions
getActiveName
getEditor
getOpenEditor
getOpenFilenames
getProject
getSRHistory
getWord
handleBookmarkSelected
handleBookmarkToggled
handleBreakpointToggled
handleClearAllBookmarks
handleClearRecent
handleClose
handleCloseAll
handleCloseWindow
handleConvertEOL
handleCursorChanged
handleEditBoxComment
handleEditComment
handleEditCopy
handleEditCut
handleEditDelete

handleEditDeselectAll
handleEditIndent
handleEditPaste
handleEditRedo
handleEditRevert
handleEditSelectAll
handleEditSelectBrace
handleEditStreamComment
handleEditUncomment
handleEditUndo
handleEditUnindent
handleEditorOpened
handleEditorSaved
handleExit
handleGoto
handleGotoBrace
handleLastEditorClosed
handleMacroDelete
handleMacroLoad
handleMacroRun
handleMacroSave
handleMacroStartRecording
handleMacroStopRecording
handleModificationStatusChanged
handleNewProject
handleNextBookmark
handleOpen
handleOpenRecent
handlePreferencesChanged
handlePreviousBookmark
handleProjectClosed
handleProjectOpened
handlePythonFile
handleReplace
handleResetUI
handleSearch
handleSearchFiles
handleShowBookmarksMenu
handleShowRecentMenu
handleShowWindowMenu
handleSplitOrientation
handleSplitView
handleToggleAll
handleToggleBookmark
handleToggleCurrent
handleZoom

handleZoomIn
handleZoomOut
initActions
initBookmarkActions
initBookmarkMenu
initBookmarkToolbar
initEditActions
initEditMenu
initEditToolbar
initFileActions
initFileMenu
initFileToolbar
initMacroActions
initMacroMenu
initSearchActions
initSearchMenu
initSearchToolbar
initViewActions
initViewMenu
initViewToolbar
initWindowActions
newEditor
printCurrentEditor
printCurrentEditorSel
removeAllViews
removeSplit
removeView
saveAllEditors
saveAsCurrentEditor
saveCurrentEditor
saveCurrentEditorToProject
saveEditor
setEditorName
setFileLine
setSbFile
setSbInfo
setSplitOrientation
showView
textForFind
tile
toggleWindow
unhighlight

| __init__

    __init__ (
            self,
            ui,
            dbs,
            )

### Constructor

#### Arguments

ui
  reference to the main user interface
dbs
  reference to the debug server object

| _getOpenStartDir

    _getOpenStartDir ( self )

### Protected method to return the starting directory for a file open dialog.

The appropriate starting directory is calculated using the following search order, until a match is found: 1: Directory of currently active editor 2: Directory of currently active Project 3: CWD

#### Returns

String name of directory to start or None

| activeWindow

    activeWindow ( self )

### Private method to return the active (i.e. current) window.

#### Returns

reference to the active editor

Exceptions |
--- | ---
RuntimeError, 'Not implemented'

| addSplit

    addSplit ( self )

Public method used to split the current view.

| addToRecentList

    addToRecentList ( self,  fn )

### Public slot to add a filename to the list of recently opened files.

#### Arguments

fn
  name of the file to be added

| addView

    addView (
            self,
            win,
            fn=None,
            )

### Private method to add a view (i.e. window)

#### Arguments

win
  editor window to be added
fn
  filename of this editor

Exceptions |
--- | ---
RuntimeError, 'Not implemented'

| canCascade

    canCascade ( self )

### Public method to signal if cascading of managed windows is available.

#### Returns

flag indicating cascading of windows is available

Exceptions |
--- | ---
RuntimeError, 'Not implemented'

| canSplit

    canSplit ( self )

### public method to signal if splitting of the view is available.

#### Returns

flag indicating splitting of the view is available.

| canTile

    canTile ( self )

### Public method to signal if tiling of managed windows is available.

#### Returns

flag indicating tiling of windows is available

Exceptions |
--- | ---
RuntimeError, 'Not implemented'

| cascade

    cascade ( self )

Public method to cascade the managed windows.

Exceptions |
--- | ---
RuntimeError, 'Not implemented'

| checkActions

    checkActions (
            self,
            editor,
            setSb=1,
            )

### Private slot to check some actions for their enable/disable status and set the statusbar info.

#### Arguments

editor
  editor window
setSb
  flag indicating an update of the status bar is wanted (boolean)

| checkAllDirty

    checkAllDirty ( self )

### Public method to check the dirty status of all editors.

#### Returns

flag indicating successful reset of all dirty flags (boolean)

| checkDirty

    checkDirty ( self,  editor )

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

#### Arguments

editor
  editor window to check

#### Returns

flag indicating successful reset of the dirty flag (boolean)

| closeEditor

    closeEditor ( self,  editor )

### Private method to close an editor window.

#### Arguments

editor
  editor window to be closed

#### Returns

flag indicating success (boolean)

| closeViewManager

    closeViewManager ( self )

### Public method to shutdown the viewmanager.

If it cannot close all editor windows, it aborts the shutdown process.

#### Returns

flag indicating success (boolean)

| displayPythonFile

    displayPythonFile (
            self,
            fn,
            lineno=None,
            )

### Public slot to display a file in an editor.

#### Arguments

fn
  name of file to be opened
lineno
  line number to place the cursor at

| editorCommand

    editorCommand ( self,  cmd )

### Private method to execute send an editor command to the active window.

#### Arguments

cmd
  the scintilla command to be sent

| editorsCheckFocusInEnabled

    editorsCheckFocusInEnabled ( self )

### Public method returning the flag indicating editors should perform focus in checks.

#### Returns

flag indicating focus in checks should be performed (boolean)

| enableEditorsCheckFocusIn

    enableEditorsCheckFocusIn ( self,  enabled )

### Public method to set a flag enabling the editors to perform focus in checks.

#### Arguments

enabled
  flag indicating focus in checks should be performed (boolean)

| 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 viewmanager receives focus.

#### Arguments

event
  the event object (QFocusEvent)

| focusOutEvent

    focusOutEvent ( self,  event )

### Public method called when the viewmanager loses focus.

#### Arguments

event
  the event object (QFocusEvent)

| getAPIs

    getAPIs ( self,  language )

### Public method to get an apis object for autocompletion/calltips

This method creates and loads the QextScintillaAPIs object dynamically upon request. This saves memory for languages, that might not be needed at the moment.

#### Arguments

language
  the language of the requested api object (string)

#### Returns

the apis object (QextScintillaAPIs)

| getActions

    getActions ( self,  type )

### Public method to get a list of all actions.

#### Arguments

type
  string denoting the action set to get. It must be one of "edit", "file", "search", "view" or "window"

#### Returns

list of all actions (list of QAction)

| getActiveName

    getActiveName ( self )

### Public method to retrieve the filename of the active window.

#### Returns

filename of active window (string)

| getEditor

    getEditor ( self,  fn )

### Private method to return the editor displaying the given file.

If there is no editor with the given file, a new editor window is created.

#### Arguments

fn
  filename to look for

#### Returns

tuple of two values giving a flag indicating a new window creation and a reference to the editor displaying this file

| getOpenEditor

    getOpenEditor ( self,  fn )

### Public method to return the editor displaying the given file.

#### Arguments

fn
  filename to look for

#### Returns

a reference to the editor displaying this file or None, if no editor was found

| getOpenFilenames

    getOpenFilenames ( self )

### Public method returning a list of the filenames of all editors.

#### Returns

list of all opened filenames (list of strings)

| getProject

    getProject ( self )

### Public method to get a reference to the Project object.

#### Returns

Reference to the Project object (Project.Project)

| getSRHistory

    getSRHistory ( self,  key )

### Private method to get the search or replace history list.

#### Arguments

key
  list to return (must be `search` or `replace`)

#### Returns

the requested history list (QStringList)

| getWord

    getWord (
            self,
            text,
            index,
            )

### Private method to get the word at a position.

#### Arguments

text
  text to look at (string or QString)
index
  position to look at (int)

#### Returns

the word at that position

| handleBookmarkSelected

    handleBookmarkSelected ( self,  id )

### Private method to handle the bookmark selected signal.

#### Arguments

id
  index of the selected menu entry This acts as an index into the list of bookmarks that was created, when the bookmarks menu was built.

| handleBookmarkToggled

    handleBookmarkToggled ( self,  editor )

### Private slot to handle the breakpointToggled signal.

It checks some bookmark actions and reemits the signal.

#### Arguments

editor
  editor that sent the signal

| handleBreakpointToggled

    handleBreakpointToggled ( self,  editor )

### Private slot to handle the breakpointToggled signal.

It simply reemits the signal.

#### Arguments

editor
  editor that sent the signal

| handleClearAllBookmarks

    handleClearAllBookmarks ( self )

Private method to handle the clear all bookmarks action.

| handleClearRecent

    handleClearRecent ( self )

Private method to clear the recent files menu.

| handleClose

    handleClose ( self )

### Public method to close the current window.

#### Returns

flag indicating success (boolean)

| handleCloseAll

    handleCloseAll ( self )

Private method to close all editor windows via file menu.

| handleCloseWindow

    handleCloseWindow ( self,  fn )

### Public method to close an arbitrary source editor.

#### Arguments

fn
  filename of editor to be closed

#### Returns

flag indicating success (boolean)

| handleConvertEOL

    handleConvertEOL ( self )

Private method to handle the convert line end characters action.

| handleCursorChanged

    handleCursorChanged (
            self,
            fn,
            line,
            pos,
            )

### Private slot to handle the cursorChanged signal.

It emits the signal cursorChanged with parameter editor.

#### Arguments

fn
  filename (string)
line
  line number of the cursor (int)
pos
  position in line of the cursor (int)

| handleEditBoxComment

    handleEditBoxComment ( self )

Private method to handle the box comment action.

| handleEditComment

    handleEditComment ( self )

Private method to handle the comment action.

| handleEditCopy

    handleEditCopy ( self )

Private method to handle the copy action.

| handleEditCut

    handleEditCut ( self )

Private method to handle the cut action.

| handleEditDelete

    handleEditDelete ( self )

Private method to handle the delete action.

| handleEditDeselectAll

    handleEditDeselectAll ( self )

Private method to handle the select all action.

| handleEditIndent

    handleEditIndent ( self )

Private method to handle the indent action.

| handleEditPaste

    handleEditPaste ( self )

Private method to handle the paste action.

| handleEditRedo

    handleEditRedo ( self )

Private method to handle the redo action.

| handleEditRevert

    handleEditRevert ( self )

Private method to handle the revert action.

| handleEditSelectAll

    handleEditSelectAll ( self )

Private method to handle the select all action.

| handleEditSelectBrace

    handleEditSelectBrace ( self )

Private method to handle the select to brace action.

| handleEditStreamComment

    handleEditStreamComment ( self )

Private method to handle the stream comment action.

| handleEditUncomment

    handleEditUncomment ( self )

Private method to handle the uncomment action.

| handleEditUndo

    handleEditUndo ( self )

Private method to handle the undo action.

| handleEditUnindent

    handleEditUnindent ( self )

Private method to handle the unindent action.

| handleEditorOpened

    handleEditorOpened ( self )

Private slot to handle the editorOpened signal.

| handleEditorSaved

    handleEditorSaved ( self,  fn )

### Public slot to handle the editorSaved signal.

It simply reemits the signal.

#### Arguments

fn
  filename of the saved editor

| handleExit

    handleExit ( self )

Public method to handle the debugged program terminating.

| handleGoto

    handleGoto ( self )

Private method to handle the goto action.

| handleGotoBrace

    handleGotoBrace ( self )

Private method to handle the goto brace action.

| handleLastEditorClosed

    handleLastEditorClosed ( self )

Private slot to handle the lastEditorClosed signal.

| handleMacroDelete

    handleMacroDelete ( self )

Private method to handle the delete macro action.

| handleMacroLoad

    handleMacroLoad ( self )

Private method to handle the load macro action.

| handleMacroRun

    handleMacroRun ( self )

Private method to handle the run macro action.

| handleMacroSave

    handleMacroSave ( self )

Private method to handle the save macro action.

| handleMacroStartRecording

    handleMacroStartRecording ( self )

Private method to handle the start macro recording action.

| handleMacroStopRecording

    handleMacroStopRecording ( self )

Private method to handle the stop macro recording action.

| handleModificationStatusChanged

    handleModificationStatusChanged (
            self,
            m,
            editor,
            )

### Private slot to handle the modificationStatusChanged signal.

#### Arguments

m
  flag indicating the modification status (boolean)
editor
  editor window changed

Exceptions |
--- | ---
RuntimeError, 'Not implemented'

| handleNewProject

    handleNewProject ( self )

Public slot to handle the NewProject signal.

| handleNextBookmark

    handleNextBookmark ( self )

Private method to handle the next bookmark action.

| handleOpen

    handleOpen ( self,  prog=None )

### Public slot to open a Python (or other) file.

#### Arguments

prog
  name of file to be opened (string or QString)

| handleOpenRecent

    handleOpenRecent ( self,  idx )

### Private method to open a file from the list of rencently opened files.

#### Arguments

idx
  index of the selected entry (int)

| handlePreferencesChanged

    handlePreferencesChanged ( self )

### Public slot to handle the preferencesChanged signal.

#### This method performs the following actions

- reread the colours for the syntax highlighting - reloads the already created API objetcs - changes in viewmanager type are activated on an application restart.

| handlePreviousBookmark

    handlePreviousBookmark ( self )

Private method to handle the previous bookmark action.

| handleProjectClosed

    handleProjectClosed ( self )

Public slot to handle the projectClosed signal.

| handleProjectOpened

    handleProjectOpened ( self )

Public slot to handle the projectOpened signal.

| handlePythonFile

    handlePythonFile (
            self,
            pyfn,
            lineno=None,
            )

### Public method to handle the user selecting a file for display.

#### Arguments

pyfn
  name of file to be opened
lineno
  line number to place the cursor at

| handleReplace

    handleReplace ( self )

Private method to handle the replace action.

| handleResetUI

    handleResetUI ( self )

Public slot to handle the resetUI signal.

| handleSearch

    handleSearch ( self )

Private method to handle the search action.

| handleSearchFiles

    handleSearchFiles ( self )

Private method to handle the search in files action.

| handleShowBookmarksMenu

    handleShowBookmarksMenu ( self )

Private method to handle the show bookmarks menu signal.

| handleShowRecentMenu

    handleShowRecentMenu ( self )

Private method to set up recent files menu.

| handleShowWindowMenu

    handleShowWindowMenu ( self,  windowMenu )

### Private method to set up the viewmanager part of the Window menu.

#### Arguments

windowMenu
  reference to the window menu

Exceptions |
--- | ---
RuntimeError, 'Not implemented'

| handleSplitOrientation

    handleSplitOrientation ( self )

Private method to handle the split orientation action.

| handleSplitView

    handleSplitView ( self )

Private method to handle the split view action.

| handleToggleAll

    handleToggleAll ( self )

Private method to handle the toggle all folds action.

| handleToggleBookmark

    handleToggleBookmark ( self )

Private method to handle the toggle bookmark action.

| handleToggleCurrent

    handleToggleCurrent ( self )

Private method to handle the toggle current fold action.

| handleZoom

    handleZoom ( self )

Private method to handle the zoom action.

| handleZoomIn

    handleZoomIn ( self )

Private method to handle the zoom in action.

| handleZoomOut

    handleZoomOut ( self )

Private method to handle the zoom out action.

| initActions

    initActions ( self )

Public method defining the user interface actions.

| initBookmarkActions

    initBookmarkActions ( self )

Private method defining the user interface actions for the bookmarks commands.

| initBookmarkMenu

    initBookmarkMenu ( self )

### Public method to create the Bookmark menu

#### Returns

the generated menu

| initBookmarkToolbar

    initBookmarkToolbar ( self )

### Public method to create the Bookmark toolbar

#### Returns

the generated toolbar

| initEditActions

    initEditActions ( self )

Private method defining the user interface actions for the edit commands.

| initEditMenu

    initEditMenu ( self )

### Public method to create the Edit menu

#### Returns

the generated menu

| initEditToolbar

    initEditToolbar ( self )

### Public method to create the Edit toolbar

#### Returns

the generated toolbar

| initFileActions

    initFileActions ( self )

Private method defining the user interface actions for file handling.

| initFileMenu

    initFileMenu ( self )

### Public method to create the File menu.

#### Returns

the generated menu

| initFileToolbar

    initFileToolbar ( self )

### Public method to create the File toolbar.

#### Returns

the generated toolbar

| initMacroActions

    initMacroActions ( self )

Private method defining the user interface actions for the macro commands.

| initMacroMenu

    initMacroMenu ( self )

### Public method to create the Macro menu

#### Returns

the generated menu

| initSearchActions

    initSearchActions ( self )

Private method defining the user interface actions for the search commands.

| initSearchMenu

    initSearchMenu ( self )

### Public method to create the Search menu

#### Returns

the generated menu

| initSearchToolbar

    initSearchToolbar ( self )

### Public method to create the Search toolbar

#### Returns

the generated toolbar

| initViewActions

    initViewActions ( self )

Protected method defining the user interface actions for the view commands.

| initViewMenu

    initViewMenu ( self )

### Public method to create the View menu

#### Returns

the generated menu

| initViewToolbar

    initViewToolbar ( self )

### Public method to create the View toolbar

#### Returns

the generated toolbar

| initWindowActions

    initWindowActions ( self )

Define the user interface actions for window handling.

Exceptions |
--- | ---
RuntimeError, 'Not implemented'

| newEditor

    newEditor ( self )

Public slot to generate a new empty editor.

| printCurrentEditor

    printCurrentEditor ( self )

Public slot to print the contents of the current editor.

| printCurrentEditorSel

    printCurrentEditorSel ( self )

Public slot to print the selection of the current editor.

| removeAllViews

    removeAllViews ( self )

Private method to remove all views (i.e. windows)

Exceptions |
--- | ---
RuntimeError, 'Not implemented'

| removeSplit

    removeSplit ( self )

### Public method used to remove the current split view.

#### Returns

Flag indicating successful deletion

| removeView

    removeView ( self,  win )

### Private method to remove a view (i.e. window)

#### Arguments

win
  editor window to be removed

Exceptions |
--- | ---
RuntimeError, 'Not implemented'

| saveAllEditors

    saveAllEditors ( self )

Public slot to save the contents of all editors.

| saveAsCurrentEditor

    saveAsCurrentEditor ( self )

Public slot to save the contents of the current editor to a new file.

| saveCurrentEditor

    saveCurrentEditor ( self )

Public slot to save the contents of the current editor.

| saveCurrentEditorToProject

    saveCurrentEditorToProject ( self )

Public slot to save the contents of the current editor to the current project.

| saveEditor

    saveEditor ( self,  fn )

### Public method to save a named editor file.

#### Arguments

fn
  filename of editor to be saved (string)

#### Returns

flag indicating success (boolean)

| setEditorName

    setEditorName (
            self,
            editor,
            newName,
            )

### Change the displayed name of the editor.

#### Arguments

editor
  editor window to be changed
newName
  new name to be shown (string or QString)

Exceptions |
--- | ---
RuntimeError, 'Not implemented'

| setFileLine

    setFileLine (
            self,
            fn,
            line,
            error=0,
            )

### Public method to update the user interface when the current program or line changes.

#### Arguments

fn
  filename of editor to update (string)
line
  line number to highlight (int)
error
  flag indicating an error highlight (boolean)

| setSbFile

    setSbFile (
            self,
            fn=None,
            line=None,
            pos=None,
            )

### Private method to set the file info in the status bar.

#### Arguments

fn
  filename to display (string)
line
  line number to display (int)
pos
  character position to display (int)

| setSbInfo

    setSbInfo (
            self,
            sbFile,
            sbLine,
            sbPos,
            sbWritable,
            )

### Public method to transfer statusbar info from the user interface to viewmanager.

#### Arguments

sbFile
  reference to the file part of the statusbar
sbLine
  reference to the line number part of the statusbar
sbPos
  reference to the character position part of the statusbar
sbWritable
  reference to the writability indicator part of the statusbar

| setSplitOrientation

    setSplitOrientation ( self,  orientation )

### Public method used to set the orientation of the split view.

#### Arguments

orientation
  orientation of the split (QSplitter.Horizontal or QSplitter.Vertical)

| showView

    showView (
            self,
            win,
            fn=None,
            )

### Private method to show a view (i.e. window)

#### Arguments

win
  editor window to be shown
fn
  filename of this editor

Exceptions |
--- | ---
RuntimeError, 'Not implemented'

| textForFind

    textForFind ( self )

### Private method to determine the selection or the current word for the next find operation.

#### Returns

selection or current word (QString)

| tile

    tile ( self )

Public method to tile the managed windows.

Exceptions |
--- | ---
RuntimeError, 'Not implemented'

| toggleWindow

    toggleWindow ( self,  w )

### Private method to toggle a workspace window.

#### Arguments

w
  editor window to be toggled

| unhighlight

    unhighlight ( self,  current=0 )

### Public method to switch off all highlights.

#### Arguments

current
  flag indicating only the current editor should be unhighlighted (boolean)

Table of Contents

This document was automatically generated by HappyDoc version 2.1