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__()

Initialize. Instanciate an IPython thread. Instanciate a WxConsoleView. Redirect I/O to console.

askExitCallback()
askExitHandler()

Default exit handler

evtCheckOptionBackgroundColor()
evtCheckOptionCompletion()
evtCheckOptionThreading()
evtStateExecuteDone()
getOptions()
keyPress()

Key press callback with plenty of shell goodness, like history, autocompletions, etc.

pager()
reloadOptions()
setAskExitHandler()

Define an exit handler

setCurrentState()
setHistoryTrackerHook()

Define a new history tracker

setOptionTrackerHook()

Define a new history tracker

setStatusTrackerHook()

Define a new status tracker

stateDoExecuteLine()
stateShowPrompt()
updateHistoryTracker()

Default history tracker (does nothing)

updateOptionTracker()

Default history tracker (does nothing)

updateStatusTracker()

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__()

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
ANSI_STYLES_BLACK = {'0;32': [2, 'GREEN'], '0;33': [3, 'BROWN'], '0;30': [0, 'WHITE'], '0;31': [1, 'RED'], '0;36': [6, 'CYAN'], '0;37': [7, 'LIGHT GREY'], '0;34': [4, 'BLUE'], '0;35': [5, 'PURPLE'], '1;35': [13, 'MEDIUM VIOLET RED'], '1;34': [12, 'LIGHT BLUE'], '1;37': [15, 'YELLOW'], '1;36': [14, 'LIGHT STEEL BLUE'], '1;31': [9, 'RED'], '1;30': [8, 'DARK GREY'], '1;33': [11, 'YELLOW'], '1;32': [10, 'SEA GREEN']}
ANSI_STYLES_WHITE = {'0;32': [2, 'GREEN'], '0;33': [3, 'BROWN'], '0;30': [0, 'BLACK'], '0;31': [1, 'RED'], '0;36': [6, 'CYAN'], '0;37': [7, 'LIGHT GREY'], '0;34': [4, 'BLUE'], '0;35': [5, 'PURPLE'], '1;35': [13, 'MEDIUM VIOLET RED'], '1;34': [12, 'LIGHT BLUE'], '1;37': [15, 'YELLOW'], '1;36': [14, 'LIGHT STEEL BLUE'], '1;31': [9, 'RED'], '1;30': [8, 'DARK GREY'], '1;33': [11, 'YELLOW'], '1;32': [10, 'SEA GREEN']}
OnUpdateUI()
asyncWrite()

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()

Replace currently entered command line with given text.

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

getBackgroundColor()
getCompletionMethod()
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()
moveCursorOnNewValidKey()
removeCurrentLine()
removeFromTo()
selectFromTo()
setBackgroundColor()
setCompletionMethod()
setIndentation()
setPrompt()
setPromptCount()
showPrompt()

Prints prompt at start of line.

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

write()

Write given text to buffer.

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

writeCompletion()
writeHistory()

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__()
addGUIShortcut()

Table Of Contents

Previous topic

gui.wx.ipython_history

Next topic

gui.wx.thread_ex

This Page