Phoenix Logo

phoenix_title wx.py.shell.Shell

Shell based on StyledTextCtrl.


class_hierarchy Class Hierarchy

Inheritance diagram for class Shell:

super_classes Known Superclasses

wx.py.editwindow.EditWindow


method_summary Methods Summary

__init__ Create Shell instance.
about Display information about Py.
addHistory Add command to the command history.
ask Get response from the user using a dialog box.
autoCallTipShow Display argument spec and docstring in a popup window.
autoCompleteShow Display auto-completion popup list.
CanCut Return true if text is selected and can be cut.
CanEdit Return true if editing should succeed.
CanPaste Return true if a paste should succeed.
clear Delete all text from the shell.
clearCommand Delete the current, unexecuted command.
clearHistory  
Copy Copy selection and place it on the clipboard.
CopyWithPrompts Copy selection, including prompts, and place it on the clipboard.
CopyWithPromptsPrefixed Copy selection, including prompts prefixed with four
Cut Remove selection and place it on the clipboard.
destroy  
execStartupScript Execute the user’s PYTHONSTARTUP script if they have one.
Execute Replace selection with text and run commands.
fixLineEndings Return text with line endings replaced by OS-specific endings.
getCommand Extract a command from text which may include a shell prompt.
GetContextMenu Create and return a context menu for the shell.
getMultilineCommand Extract a multi-line command from the editor.
insertLineBreak Insert a new line break.
LoadSettings  
lstripPrompt Return text without a leading prompt.
OnCallTipAutoCompleteManually AutoComplete and Calltips manually.
OnChar Keypress event handler.
OnContextMenu  
OnHistoryInsert Insert the previous/next command from the history buffer.
OnHistoryReplace Replace with the previous/next command from the history buffer.
OnHistorySearch Search up the history buffer for the text in front of the cursor.
OnIdle Free the CPU to do other things.
OnKeyDown Key down event handler.
OnShowCompHistory Show possible autocompletion Words from already typed words.
OnUpdateUI  
Paste Replace selection with clipboard contents.
PasteAndRun Replace selection with clipboard contents, run commands.
pause Halt execution pending a response from the user.
processLine Process the line of text at which the user hit Enter.
prompt Display proper prompt for the context: ps1, ps2 or ps3.
push Send command to the interpreter for execution.
quit Quit the application.
raw_input Return string based on user input.
readline Replacement for stdin.readline().
readlines Replacement for stdin.readlines().
redirectStderr If redirect is true then sys.stderr will go to the shell.
redirectStdin If redirect is true then sys.stdin will come from the shell.
redirectStdout If redirect is true then sys.stdout will go to the shell.
replaceFromHistory Replace selection with command from the history buffer.
run Execute command as if it was typed in directly.
runfile Execute all commands in file as if they were typed into the
SaveSettings  
setBuiltinKeywords Create pseudo keywords as part of builtins.
setFocus Set focus to the shell.
setLocalShell Add ‘shell’ to locals as reference to ShellFacade instance.
setStatusText Display status information.
showIntro Display introductory text in the shell.
wrap Sets whether text is word wrapped.
write Display text in the shell.
writeErr Replacement for stderr.
writeOut Replacement for stdout.
zoom Set the zoom level.

api Class API



class Shell(editwindow.EditWindow)

Shell based on StyledTextCtrl.


Methods



__init__(self, parent, id=-1, pos=wx.DefaultPosition, size=wx.DefaultSize, style=wx.CLIP_CHILDREN, introText='', locals=None, InterpClass=None, startupScript=None, execStartupScript=True, *args, **kwds)

Create Shell instance.



about(self)

Display information about Py.



addHistory(self, command)

Add command to the command history.



ask(self, prompt='Please enter your response:')

Get response from the user using a dialog box.



autoCallTipShow(self, command, insertcalltip = True, forceCallTip = False)

Display argument spec and docstring in a popup window.



autoCompleteShow(self, command, offset = 0)

Display auto-completion popup list.



CanCut(self)

Return true if text is selected and can be cut.



CanEdit(self)

Return true if editing should succeed.



CanPaste(self)

Return true if a paste should succeed.



clear(self)

Delete all text from the shell.



clearCommand(self)

Delete the current, unexecuted command.



clearHistory(self)


Copy(self)

Copy selection and place it on the clipboard.



CopyWithPrompts(self)

Copy selection, including prompts, and place it on the clipboard.



CopyWithPromptsPrefixed(self)

Copy selection, including prompts prefixed with four spaces, and place it on the clipboard.



Cut(self)

Remove selection and place it on the clipboard.



destroy(self)


execStartupScript(self, startupScript)

Execute the user’s PYTHONSTARTUP script if they have one.



Execute(self, text)

Replace selection with text and run commands.



fixLineEndings(self, text)

Return text with line endings replaced by OS-specific endings.



getCommand(self, text=None, rstrip=True)

Extract a command from text which may include a shell prompt.

The command may not necessarily be valid Python syntax.



GetContextMenu(self)

Create and return a context menu for the shell. This is used instead of the scintilla default menu in order to correctly respect our immutable buffer.



getMultilineCommand(self, rstrip=True)

Extract a multi-line command from the editor.

The command may not necessarily be valid Python syntax.



insertLineBreak(self)

Insert a new line break.



LoadSettings(self, config)


lstripPrompt(self, text)

Return text without a leading prompt.



OnCallTipAutoCompleteManually(self, shiftDown)

AutoComplete and Calltips manually.



OnChar(self, event)

Keypress event handler.

Only receives an event if OnKeyDown calls event.Skip() for the corresponding event.



OnContextMenu(self, evt)


OnHistoryInsert(self, step)

Insert the previous/next command from the history buffer.



OnHistoryReplace(self, step)

Replace with the previous/next command from the history buffer.



OnHistorySearch(self)

Search up the history buffer for the text in front of the cursor.



OnIdle(self, event)

Free the CPU to do other things.



OnKeyDown(self, event)

Key down event handler.



OnShowCompHistory(self)

Show possible autocompletion Words from already typed words.



OnUpdateUI(self, evt)


Paste(self)

Replace selection with clipboard contents.



PasteAndRun(self)

Replace selection with clipboard contents, run commands.



pause(self)

Halt execution pending a response from the user.



processLine(self)

Process the line of text at which the user hit Enter.



prompt(self)

Display proper prompt for the context: ps1, ps2 or ps3.

If this is a continuation line, autoindent as necessary.



push(self, command, silent = False)

Send command to the interpreter for execution.



quit(self)

Quit the application.



raw_input(self, prompt='')

Return string based on user input.



readline(self)

Replacement for stdin.readline().



readlines(self)

Replacement for stdin.readlines().



redirectStderr(self, redirect=True)

If redirect is true then sys.stderr will go to the shell.



redirectStdin(self, redirect=True)

If redirect is true then sys.stdin will come from the shell.



redirectStdout(self, redirect=True)

If redirect is true then sys.stdout will go to the shell.



replaceFromHistory(self, step)

Replace selection with command from the history buffer.



run(self, command, prompt=True, verbose=True)

Execute command as if it was typed in directly. >>> shell.run(‘print(“this”)’) >>> print(“this”) this >>>



runfile(self, filename)

Execute all commands in file as if they were typed into the shell.



SaveSettings(self, config)


setBuiltinKeywords(self)

Create pseudo keywords as part of builtins.

This sets “close”, “exit” and “quit” to a helpful string.



setFocus(self)

Set focus to the shell.



setLocalShell(self)

Add ‘shell’ to locals as reference to ShellFacade instance.



setStatusText(self, text)

Display status information.



showIntro(self, text='')

Display introductory text in the shell.



wrap(self, wrap=True)

Sets whether text is word wrapped.



write(self, text)

Display text in the shell.

Replace line endings with OS-specific endings.



writeErr(self, text)

Replacement for stderr.



writeOut(self, text)

Replacement for stdout.



zoom(self, points=0)

Set the zoom level.

This number of points is added to the size of all fonts. It may be positive to magnify or negative to reduce.