gui.wx.ipython_view

Module: gui.wx.ipython_view

Inheritance diagram for IPython.gui.wx.ipython_view:

Provides IPython WX console widgets.

@author: Laurent Dufrechou laurent.dufrechou _at_ gmail.com This WX widget is based on the original work of Eitan Isaacson that provided the console for the GTK toolkit.

Original work from: @author: Eitan Isaacson @organization: IBM Corporation @copyright: Copyright (c) 2007 IBM Corporation @license: BSD

All rights reserved. This program and the accompanying materials are made available under the terms of the BSD which accompanies this distribution, and is available at U{http://www.opensource.org/licenses/bsd-license.php}

Classes

IPShellWidget

class IPython.gui.wx.ipython_view.IPShellWidget(parent, intro=None, background_color='BLACK', add_button_handler=None, wx_ip_shell=None, user_ns={}, user_global_ns=None)

Bases: wx._windows.Panel

This is wx.Panel that embbed the IPython Thread and the wx.StyledTextControl If you want to port this to any other GUI toolkit, just replace the WxConsoleView by YOURGUIConsoleView and make YOURGUIIPythonView derivate from whatever container you want. I’ve choosed to derivate from a wx.Panel because it seems to be more useful Any idea to make it more ‘generic’ welcomed.

__init__(parent, intro=None, background_color='BLACK', add_button_handler=None, wx_ip_shell=None, user_ns={}, user_global_ns=None)
Initialize. Instanciate an IPython thread. Instanciate a WxConsoleView. Redirect I/O to console.
askExitCallback(event)
askExitHandler(event)
Default exit handler
evtCheckOptionBackgroundColor(event)
evtCheckOptionCompletion(event)
evtCheckOptionThreading(event)
evtStateExecuteDone(evt)
getOptions()
keyPress(event)
Key press callback with plenty of shell goodness, like history, autocompletions, etc.
pager(text)
reloadOptions(options)
setAskExitHandler(func)
Define an exit handler
setCurrentState(state)
setHistoryTrackerHook(func)
Define a new history tracker
setOptionTrackerHook(func)
Define a new history tracker
setStatusTrackerHook(func)
Define a new status tracker
stateDoExecuteLine()
stateShowPrompt()
updateHistoryTracker(command_line)
Default history tracker (does nothing)
updateOptionTracker(name, value)
Default history tracker (does nothing)
updateStatusTracker(status)
Default status tracker (does nothing)

WxConsoleView

class IPython.gui.wx.ipython_view.WxConsoleView(parent, prompt, intro='', background_color='BLACK', pos=wx.Point(-1, -1), ID=-1, size=wx.Size(-1, -1), style=0, autocomplete_mode='IPYTHON')

Bases: wx.stc.StyledTextCtrl

Specialized styled text control view for console-like workflow. We use here a scintilla frontend thus it can be reused in any GUI that supports scintilla with less work.

@cvar ANSI_COLORS_BLACK: Mapping of terminal colors to X11 names.
(with Black background)

@type ANSI_COLORS_BLACK: dictionary

@cvar ANSI_COLORS_WHITE: Mapping of terminal colors to X11 names.
(with White background)

@type ANSI_COLORS_WHITE: dictionary

@ivar color_pat: Regex of terminal color pattern @type color_pat: _sre.SRE_Pattern

__init__(parent, prompt, intro='', background_color='BLACK', pos=wx.Point(-1, -1), ID=-1, size=wx.Size(-1, -1), style=0, autocomplete_mode='IPYTHON')

Initialize console view.

@param parent: Parent widget @param prompt: User specified prompt @type intro: string @param intro: User specified startup introduction string @type intro: string @param background_color: Can be BLACK or WHITE @type background_color: string @param other: init param of styledTextControl (can be used as-is) @param autocomplete_mode: Can be ‘IPYTHON’ or ‘STC’

‘IPYTHON’ show autocompletion the ipython way ‘STC” show it scintilla text control way
OnUpdateUI(evt)
asyncWrite(text)
Write given text to buffer in an asynchroneous way. It is used from another thread to be able to acces the GUI. @param text: Text to append @type text: string
buildStyles()
changeLine(text)

Replace currently entered command line with given text.

@param text: Text to use as replacement. @type text: string

getBackgroundColor(color)
getCompletionMethod(completion)
getCurrentLine()

Get text in current command line.

@return: Text of current command line. @rtype: string

getCurrentLineEnd()
getCurrentLineStart()
getCurrentPromptStart()
getCursorPos()
getPromptLen()
Return the length of current prompt
moveCursor(position)
moveCursorOnNewValidKey()
removeCurrentLine()
removeFromTo(from_pos, to_pos)
selectFromTo(from_pos, to_pos)
setBackgroundColor(color)
setCompletionMethod(completion)
setIndentation(indentation)
setPrompt(prompt)
setPromptCount(count)
showPrompt()

Prints prompt at start of line.

@param prompt: Prompt to print. @type prompt: string

write(text)

Write given text to buffer.

@param text: Text to append. @type text: string

writeCompletion(possibilities)
writeHistory(history)

WxNonBlockingIPShell

class IPython.gui.wx.ipython_view.WxNonBlockingIPShell(parent, argv=[], user_ns={}, user_global_ns=None, cin=None, cout=None, cerr=None, ask_exit_handler=None)

Bases: IPython.gui.wx.ipshell_nonblocking.NonBlockingIPShell

An NonBlockingIPShell Thread that is WX dependent.

__init__(parent, argv=[], user_ns={}, user_global_ns=None, cin=None, cout=None, cerr=None, ask_exit_handler=None)
addGUIShortcut(text, func)