Package wx :: Package py :: Module shell :: Class Shell

[frames | no frames]

## Type Shell

    object --+
             |
        Object --+
                 |
        EvtHandler --+
                     |
                Window --+
                         |
                   Control --+
                             |
                StyledTextCtrl --+
                                 |
                        EditWindow --+
                                     |
                                    Shell

Shell based on StyledTextCtrl.

Method Summary
| ``__init__`(self, parent, id, pos, size, style, introText, locals, InterpClass, startupScript, execStartupScript, *args, **kwds)` Create Shell instance.
| ``about`(self)` Display information about Py.
| ``addHistory`(self, command)` Add command to the command history.
| ``ask`(self, prompt)` Get response from the user using a dialog box.
| ``autoCallTipShow`(self, command, insertcalltip, forceCallTip)` Display argument spec and docstring in a popup window.
| ``autoCompleteShow`(self, command, offset)` 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, rstrip)` Extract a command from text which may include a shell prompt.
| ``getMultilineCommand`(self, rstrip)` Extract a multi-line command from the editor.
| ``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.
| ``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.
| ``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.
| ``push`(self, command, silent)` 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)` If redirect is true then sys.stderr will go to the shell.
| ``redirectStdin`(self, redirect)` If redirect is true then sys.stdin will come from the shell.
| ``redirectStdout`(self, redirect)` 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, verbose)` Execute command as if it was typed in directly.
| ``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.
| ``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)` Sets whether text is word wrapped.
| ``write`(self, text)` Display text in the shell.
| ``writeErr`(self, text)` Replacement for stderr.
| ``writeOut`(self, text)` Replacement for stdout.
| ``zoom`(self, points)` Set the zoom level.

Property Summary

Class Variable Summary
`str` | `name` = `'Shell'`
`str` | `revision` = `'1.20'`

Instance Method Details

### __init__(self, parent, id=-1, pos=wx.Point(-1, -1), size=wx.Size(-1, -1), style=4194304, introText='', locals=None, InterpClass=None, startupScript=None, execStartupScript=True, *args, **kwds)
(Constructor)

Create Shell instance.

  Overrides:
    `wx.py.editwindow.EditWindow.__init__`

### 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.

  Overrides:
    `wx.py.editwindow.EditWindow.CanCut`

### CanEdit(self)

Return true if editing should succeed.

  Overrides:
    `wx.py.editwindow.EditWindow.CanEdit`

### CanPaste(self)

Return true if a paste should succeed.

  Overrides:
    `wx.py.editwindow.EditWindow.CanPaste`

### clear(self)

Delete all text from the shell.

### clearCommand(self)

Delete the current, unexecuted command.

### Copy(self)

Copy selection and place it on the clipboard.

  Overrides:
    `wx.stc.StyledTextCtrl.Copy`

### 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.

  Overrides:
    `wx.stc.StyledTextCtrl.Cut`

### 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.

### 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.

### 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.

### 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.

### Paste(self)

Replace selection with clipboard contents.

  Overrides:
    `wx.stc.StyledTextCtrl.Paste`

### 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.

### 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.

Class Variable Details

### name

  Type:
    `str`
  Value:

        'Shell'

### revision

  Type:
    `str`
  Value:

        '1.20'

Generated by Epydoc 2.1.20050511.rpd on Thu Mar 22 12:09:25 2007 | http://epydoc.sf.net