# eric4.QScintilla.Shell

Module implementing a graphical Python shell.

### Global Attributes

None

### Classes

Shell | Class implementing a graphical Python shell.

### Functions

None

## Shell

Class implementing a graphical Python shell.

A user can enter commands that are executed in the remote Python interpreter.

### Derived from

QsciScintillaCompat

### Class Attributes

None

### Class Methods

None

### Methods

Shell | Constructor
__QScintillaAutoCompletionCommand | Private method to handle a command for autocompletion only.
__QScintillaCharLeft | Private method to handle the Cursor Left command.
__QScintillaCharLeftExtend | Private method to handle the Extend Selection Left command.
__QScintillaCharRight | Private method to handle the Cursor Right command.
__QScintillaDelete | Private method to handle the delete command.
__QScintillaDeleteBack | Private method to handle the Backspace key.
__QScintillaDeleteLineLeft | Private method to handle the Delete Line Left command.
__QScintillaDeleteLineRight | Private method to handle the Delete Line Right command.
__QScintillaDeleteWordLeft | Private method to handle the Delete Word Left command.
__QScintillaDeleteWordRight | Private method to handle the Delete Word Right command.
__QScintillaLeftCommand | Private method to handle a QScintilla command working to the left.
__QScintillaLeftDeleteCommand | Private method to handle a QScintilla delete command working to the left.
__QScintillaLineDown | Private method to handle the Down key.
__QScintillaLineEnd | Private method to handle the End key.
__QScintillaLineUp | Private method to handle the Up key.
__QScintillaNewline | Private method to handle the Return key.
__QScintillaRightCommand | Private method to handle a QScintilla command working to the right.
__QScintillaTab | Private method to handle the Tab key.
__QScintillaVCHome | Private method to handle the Home key.
__QScintillaVCHomeExtend | Private method to handle the Extend Selection to start of line command.
__QScintillaWordLeft | Private method to handle the Cursor Word Left command.
__QScintillaWordLeftExtend | Private method to handle the Extend Selection Left one word command.
__QScintillaWordRight | Private method to handle the Cursor Word Right command.
__bindLexer | Private slot to set the lexer.
__clearCurrentLine | Private method to clear the line containing the cursor.
__clearHistory | Private slot to clear the current history.
__clientCapabilities | Private slot to handle the reporting of the clients capabilities.
__clientError | Private method to handle an error in the client.
__clientStatement | Private method to handle the response from the debugger client.
__completionListSelected | Private slot to handle the selection from the completion list.
__configure | Private method to open the configuration dialog.
__executeCommand | Private slot to execute a command.
__getBanner | Private method to get the banner for the remote interpreter.
__getEndPos | Private method to return the line and column of the last character.
__initialise | Private method to get ready for a new remote interpreter.
__insertHistory | Private method to insert a command selected from the history.
__insertText | Private method to insert some text at the current cursor position.
__insertTextAtEnd | Private method to insert some text at the end of the command line.
__insertTextNoEcho | Private method to insert some text at the end of the buffer without echoing it.
__isCursorOnLastLine | Private method to check, if the cursor is on the last line.
__middleMouseButton | Private method to handle the middle mouse button press.
__raw_input | Private method to handle raw input.
__reset | Private slot to handle the 'reset' context menu entry.
__resetAndClear | Private slot to handle the 'reset and clear' context menu entry.
__rsearchHistory | Private method used to reverse search the history.
__searchHistory | Private method used to search the history.
__selectHistory | Private slot to select a history entry to execute.
__setAutoCompletion | Private method to configure the autocompletion function.
__setCallTips | Private method to configure the calltips function.
__setMargin0 | Private method to configure margin 0.
__setMonospaced | Private method to set/reset a monospaced font.
__setTextDisplay | Private method to configure the text display.
__showCompletions | Private method to display the possible completions.
__showHistory | Private slot to show the shell history dialog.
__startDebugClient | Private slot to start a debug client accoding to the action triggered.
__useHistory | Private method to display a command from the history.
__write | Private method to display some text.
__writeBanner | Private method to write a banner with info from the debug client.
__writePrompt | Private method to write the prompt.
__writeStdErr | Private method to display some text with StdErr label.
__writeStdOut | Private method to display some text with StdOut label.
clear | Public slot to clear the display.
closeShell | Public method to shutdown the shell.
contextMenuEvent | Reimplemented to show our own context menu.
dragEnterEvent | Protected method to handle the drag enter event.
dragLeaveEvent | Protected method to handle the drag leave event.
dragMoveEvent | Protected method to handle the drag move event.
dropEvent | Protected method to handle the drop event.
editorCommand | Public method to perform an editor command.
executeLines | Public method to execute a set of lines as multiple commands.
focusInEvent | Public method called when the shell receives focus.
focusNextPrevChild | Reimplemented to stop Tab moving to the next window.
focusOutEvent | Public method called when the shell loses focus.
getClientType | Public slot to get the clients type.
getHistory | Public method to get the history for the given client type.
handlePreferencesChanged | Public slot to handle the preferencesChanged signal.
insert | Public slot to insert text at the current cursor position.
keyPressEvent | Re-implemented to handle the user input a key at a time.
loadHistory | Public method to load the history for the given client type.
mousePressEvent | Protected method to handle the mouse press event.
paste | Reimplemented slot to handle the paste action.
reloadHistory | Public method to reload the history of the currently selected client type.
saveHistory | Public method to save the history for the given client type.
setDebuggerUI | Public method to set the debugger UI.

### Static Methods

None

#### Shell (Constructor)

Shell(dbs, vm, parent = None)

Constructor

dbs
  reference to the debug server object
vm
  reference to the viewmanager object
parent
  parent widget (QWidget)

#### Shell.__QScintillaAutoCompletionCommand

__QScintillaAutoCompletionCommand(cmd)

Private method to handle a command for autocompletion only.

cmd
  QScintilla command

#### Shell.__QScintillaCharLeft

__QScintillaCharLeft()

Private method to handle the Cursor Left command.

#### Shell.__QScintillaCharLeftExtend

__QScintillaCharLeftExtend()

Private method to handle the Extend Selection Left command.

#### Shell.__QScintillaCharRight

__QScintillaCharRight()

Private method to handle the Cursor Right command.

#### Shell.__QScintillaDelete

__QScintillaDelete()

Private method to handle the delete command.

#### Shell.__QScintillaDeleteBack

__QScintillaDeleteBack()

Private method to handle the Backspace key.

#### Shell.__QScintillaDeleteLineLeft

__QScintillaDeleteLineLeft()

Private method to handle the Delete Line Left command.

#### Shell.__QScintillaDeleteLineRight

__QScintillaDeleteLineRight()

Private method to handle the Delete Line Right command.

#### Shell.__QScintillaDeleteWordLeft

__QScintillaDeleteWordLeft()

Private method to handle the Delete Word Left command.

#### Shell.__QScintillaDeleteWordRight

__QScintillaDeleteWordRight()

Private method to handle the Delete Word Right command.

#### Shell.__QScintillaLeftCommand

__QScintillaLeftCommand(method, allLinesAllowed = False)

Private method to handle a QScintilla command working to the left.

method
  shell method to execute

#### Shell.__QScintillaLeftDeleteCommand

__QScintillaLeftDeleteCommand(method)

Private method to handle a QScintilla delete command working to the left.

method
  shell method to execute

#### Shell.__QScintillaLineDown

__QScintillaLineDown(cmd)

Private method to handle the Down key.

cmd
  QScintilla command

#### Shell.__QScintillaLineEnd

__QScintillaLineEnd(cmd)

Private method to handle the End key.

cmd
  QScintilla command

#### Shell.__QScintillaLineUp

__QScintillaLineUp(cmd)

Private method to handle the Up key.

cmd
  QScintilla command

#### Shell.__QScintillaNewline

__QScintillaNewline(cmd)

Private method to handle the Return key.

cmd
  QScintilla command

#### Shell.__QScintillaRightCommand

__QScintillaRightCommand(method)

Private method to handle a QScintilla command working to the right.

method
  shell method to execute

#### Shell.__QScintillaTab

__QScintillaTab(cmd)

Private method to handle the Tab key.

cmd
  QScintilla command

#### Shell.__QScintillaVCHome

__QScintillaVCHome(cmd)

Private method to handle the Home key.

cmd
  QScintilla command

#### Shell.__QScintillaVCHomeExtend

__QScintillaVCHomeExtend()

Private method to handle the Extend Selection to start of line command.

#### Shell.__QScintillaWordLeft

__QScintillaWordLeft()

Private method to handle the Cursor Word Left command.

#### Shell.__QScintillaWordLeftExtend

__QScintillaWordLeftExtend()

Private method to handle the Extend Selection Left one word command.

#### Shell.__QScintillaWordRight

__QScintillaWordRight()

Private method to handle the Cursor Word Right command.

#### Shell.__bindLexer

__bindLexer(language = 'Python')

Private slot to set the lexer.

language
  lexer language to set

#### Shell.__clearCurrentLine

__clearCurrentLine()

Private method to clear the line containing the cursor.

#### Shell.__clearHistory

__clearHistory()

Private slot to clear the current history.

#### Shell.__clientCapabilities

__clientCapabilities(cap, clType)

Private slot to handle the reporting of the clients capabilities.

cap
  client capabilities (integer)
clType
  type of the debug client (string)

#### Shell.__clientError

__clientError()

Private method to handle an error in the client.

#### Shell.__clientStatement

__clientStatement(more)

Private method to handle the response from the debugger client.

more
  flag indicating that more user input is required

#### Shell.__completionListSelected

__completionListSelected(id, txt)

Private slot to handle the selection from the completion list.

id
  the ID of the user list (should be 1) (integer)
txt
  the selected text (QString)

#### Shell.__configure

__configure()

Private method to open the configuration dialog.

#### Shell.__executeCommand

__executeCommand(cmd)

Private slot to execute a command.

cmd
  command to be executed by debug client (string)

#### Shell.__getBanner

__getBanner()

Private method to get the banner for the remote interpreter.

It requests the interpreter version and platform running on the debug client side.

#### Shell.__getEndPos

__getEndPos()

Private method to return the line and column of the last character.

Returns:
  tuple of two values (int, int) giving the line and column

#### Shell.__initialise

__initialise()

Private method to get ready for a new remote interpreter.

#### Shell.__insertHistory

__insertHistory(cmd)

Private method to insert a command selected from the history.

cmd
  history entry to be inserted (string or QString)

#### Shell.__insertText

__insertText(s)

Private method to insert some text at the current cursor position.

s
  text to be inserted (string or QString)

#### Shell.__insertTextAtEnd

__insertTextAtEnd(s)

Private method to insert some text at the end of the command line.

s
  text to be inserted (string or QString)

#### Shell.__insertTextNoEcho

__insertTextNoEcho(s)

Private method to insert some text at the end of the buffer without echoing it.

s
  text to be inserted (string or QString)

#### Shell.__isCursorOnLastLine

__isCursorOnLastLine()

Private method to check, if the cursor is on the last line.

#### Shell.__middleMouseButton

__middleMouseButton()

Private method to handle the middle mouse button press.

#### Shell.__raw_input

__raw_input(s, echo)

Private method to handle raw input.

s
  prompt to be displayed (string or QString)
echo
  Flag indicating echoing of the input (boolean)

#### Shell.__reset

__reset()

Private slot to handle the 'reset' context menu entry.

#### Shell.__resetAndClear

__resetAndClear()

Private slot to handle the 'reset and clear' context menu entry.

#### Shell.__rsearchHistory

__rsearchHistory(txt, startIdx = -1)

Private method used to reverse search the history.

txt
  text to match at the beginning (string or QString)
startIdx
  index to start search from (integer)

Returns:
  index of

#### Shell.__searchHistory

__searchHistory(txt, startIdx = -1)

Private method used to search the history.

txt
  text to match at the beginning (string or QString)
startIdx
  index to start search from (integer)

Returns:
  index of

#### Shell.__selectHistory

__selectHistory()

Private slot to select a history entry to execute.

#### Shell.__setAutoCompletion

__setAutoCompletion(language = 'Python')

Private method to configure the autocompletion function.

language
  of the autocompletion set to set

#### Shell.__setCallTips

__setCallTips(language = 'Python')

Private method to configure the calltips function.

language
  of the calltips set to set

#### Shell.__setMargin0

__setMargin0()

Private method to configure margin 0.

#### Shell.__setMonospaced

__setMonospaced(on)

Private method to set/reset a monospaced font.

on
  flag to indicate usage of a monospace font (boolean)

#### Shell.__setTextDisplay

__setTextDisplay()

Private method to configure the text display.

#### Shell.__showCompletions

__showCompletions(completions, text)

Private method to display the possible completions.

#### Shell.__showHistory

__showHistory()

Private slot to show the shell history dialog.

#### Shell.__startDebugClient

__startDebugClient(action)

Private slot to start a debug client accoding to the action triggered.

action
  context menu action that was triggered (QAction)

#### Shell.__useHistory

__useHistory()

Private method to display a command from the history.

#### Shell.__write

__write(s)

Private method to display some text.

s
  text to be displayed (string or QString)

#### Shell.__writeBanner

__writeBanner(version, platform, dbgclient)

Private method to write a banner with info from the debug client.

version
  interpreter version string (string)
platform
  platform of the remote interpreter (string)
dbgclient
  debug client variant used (string)

#### Shell.__writePrompt

__writePrompt()

Private method to write the prompt.

#### Shell.__writeStdErr

__writeStdErr(s)

Private method to display some text with StdErr label.

s
  text to be displayed (string or QString)

#### Shell.__writeStdOut

__writeStdOut(s)

Private method to display some text with StdOut label.

s
  text to be displayed (string or QString)

#### Shell.clear

clear()

Public slot to clear the display.

#### Shell.closeShell

closeShell()

Public method to shutdown the shell.

#### Shell.contextMenuEvent

contextMenuEvent(ev)

Reimplemented to show our own context menu.

ev
  context menu event (QContextMenuEvent)

#### Shell.dragEnterEvent

dragEnterEvent(event)

Protected method to handle the drag enter event.

event
  the drag enter event (QDragEnterEvent)

#### Shell.dragLeaveEvent

dragLeaveEvent(event)

Protected method to handle the drag leave event.

event
  the drag leave event (QDragLeaveEvent)

#### Shell.dragMoveEvent

dragMoveEvent(event)

Protected method to handle the drag move event.

event
  the drag move event (QDragMoveEvent)

#### Shell.dropEvent

dropEvent(event)

Protected method to handle the drop event.

event
  the drop event (QDropEvent)

#### Shell.editorCommand

editorCommand(cmd)

Public method to perform an editor command.

cmd
  the scintilla command to be performed

#### Shell.executeLines

executeLines(lines)

Public method to execute a set of lines as multiple commands.

lines
  multiple lines of text to be executed as single commands (string or QString)

#### Shell.focusInEvent

focusInEvent(event)

Public method called when the shell receives focus.

event
  the event object (QFocusEvent)

#### Shell.focusNextPrevChild

focusNextPrevChild(next)

Reimplemented to stop Tab moving to the next window.

While the user is entering a multi-line command, the movement to the next window by the Tab key being pressed is suppressed.

next
  next window

Returns:
  flag indicating the movement

#### Shell.focusOutEvent

focusOutEvent(event)

Public method called when the shell loses focus.

event
  the event object (QFocusEvent)

#### Shell.getClientType

getClientType()

Public slot to get the clients type.

Returns:
  client type (string)

#### Shell.getHistory

getHistory(clientType)

Public method to get the history for the given client type.

clientType
  type of the debug client (string). If it is None, the current history is returned.

Returns:
  reference to the history list (QStringList)

#### Shell.handlePreferencesChanged

handlePreferencesChanged()

Public slot to handle the preferencesChanged signal.

#### Shell.insert

insert(text)

Public slot to insert text at the current cursor position.

The cursor is advanced to the end of the inserted text.

text
  text to be inserted (string or QString)

#### Shell.keyPressEvent

keyPressEvent(ev)

Re-implemented to handle the user input a key at a time.

ev
  key event (QKeyEvent)

#### Shell.loadHistory

loadHistory(clientType)

Public method to load the history for the given client type.

clientType
  type of the debug client (string)

#### Shell.mousePressEvent

mousePressEvent(event)

Protected method to handle the mouse press event.

event
  the mouse press event (QMouseEvent)

#### Shell.paste

paste()

Reimplemented slot to handle the paste action.

#### Shell.reloadHistory

reloadHistory()

Public method to reload the history of the currently selected client type.

#### Shell.saveHistory

saveHistory(clientType)

Public method to save the history for the given client type.

clientType
  type of the debug client (string)

#### Shell.setDebuggerUI

setDebuggerUI(ui)

Public method to set the debugger UI.

ui
  reference to the debugger UI object (DebugUI)

Up