frontend.wx.console_widget

Module: frontend.wx.console_widget

Inheritance diagram for IPython.frontend.wx.console_widget:

A Wx widget to act as a console and input commands.

This widget deals with prompts and provides an edit buffer restricted to after the last prompt.

ConsoleWidget

class IPython.frontend.wx.console_widget.ConsoleWidget(parent, id=-1, pos=wx.Point(-1, -1), size=wx.Size(-1, -1), style=262144)

Bases: wx.py.editwindow.EditWindow

Specialized styled text control view for console-like workflow.

This widget is mainly interested in dealing with the prompt and keeping the cursor inside the editing line.

__init__()
ANSI_STYLES = {'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'], '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']}
OnUpdateUI()

Override the OnUpdateUI of the EditWindow class, to prevent syntax highlighting both for faster redraw, and for more consistent look and feel.

configure_scintilla()

Set up all the styling option of the embedded scintilla widget.

continuation_prompt()

Returns the current continuation prompt. We need to implement this method here to deal with the ascii escape sequences cleaning up.

faces = {'helv': 'Helvetica', 'size2': 8, 'mono': 'Courier', 'size': 10, 'other': 'new century schoolbook', 'times': 'Times'}
get_line_width()

Return the width of the line in characters.

input_buffer

Returns the text in current edit buffer.

last_prompt = ''
new_prompt()

Prints a prompt at start of line, and move the start of the current block there.

The prompt can be given with ascii escape sequences.

pop_completion()

Pops up an autocompletion menu. Offset is the offset in characters of the position at which the menu should appear, relativ to the cursor.

scroll_to_bottom()
style = {'comment': 'fore:#007F00', 'bracebad': 'fore:#FF0000,back:#000000,bold', 'string': 'fore:#7F007F,italic', 'trace': '#FAFAF1', 'stdout': '#FDFFD3', 'number': 'fore:#007F7F', 'char': 'fore:#7F007F,italic', 'tripledouble': 'fore:#7F0000', 'triple': 'fore:#7F0000', 'operator': 'bold', 'carret_color': 'BLACK', 'background_color': 'WHITE', 'class': 'fore:#0000FF,bold,underline', 'prompt_in1': '\n\x01\x1b[0;34m\x02In [\x01\x1b[1;34m\x02$number\x01\x1b[0;34m\x02]: \x01\x1b[0m\x02', 'keyword': 'fore:#00007F,bold', 'edge_column': -1, 'default': 'size:10', 'bracegood': 'fore:#00AA00,back:#000000,bold', 'antialiasing': True, 'prompt_out': '\x01\x1b[0;31m\x02Out[\x01\x1b[1;31m\x02$number\x01\x1b[0;31m\x02]: \x01\x1b[0m\x02', 'stderr': '#FFF1F1', 'def': 'fore:#007F7F,bold'}
title = 'Console'
write()

Write given text to buffer, while translating the ansi escape sequences.

Table Of Contents

Previous topic

frontend.process.pipedprocess

Next topic

frontend.wx.ipythonx

This Page