A Discrete-Event Network Simulator
API
Public Member Functions | Public Attributes | Static Public Attributes | Private Member Functions | List of all members
visualizer.ipython_view.ConsoleView Class Reference

ConsoleView class. More...

+ Inheritance diagram for visualizer.ipython_view.ConsoleView:

Public Member Functions

def __init__ (self)
 
def changeLine (self, text)
 Replace currently entered command line with given text. More...
 
def getCurrentLine (self)
 Get text in current command line. More...
 
def onKeyPress (self, widget, event)
 Key press callback used for correcting behavior for console-like interfaces. More...
 
def onKeyPressExtend (self, event)
 For some reason we can't extend onKeyPress directly (bug #500900). More...
 
def showPrompt (self, prompt)
 Prints prompt at start of line. More...
 
def showReturned (self, text)
 Show returned text from last command and print new prompt. More...
 
def write (self, text, editable=False)
 Write given text to buffer. More...
 

Public Attributes

 color_pat
 color pattern More...
 
 line_start
 line start More...
 
 mark
 scroll mark More...
 
 text_buffer
 text buffer More...
 

Static Public Attributes

dictionary ANSI_COLORS
 color list More...
 

Private Member Functions

def _changeLine (self, text)
 Replace currently entered command line with given text. More...
 
def _showPrompt (self, prompt)
 Prints prompt at start of line. More...
 
def _showReturned (self, text)
 Show returned text from last command and print new prompt. More...
 
def _write (self, text, editable=False)
 Write given text to buffer. More...
 

Detailed Description

ConsoleView class.

Definition at line 331 of file ipython_view.py.

Constructor & Destructor Documentation

◆ __init__()

def visualizer.ipython_view.ConsoleView.__init__ (   self)
Initialize console view.

Definition at line 366 of file ipython_view.py.

Member Function Documentation

◆ _changeLine()

def visualizer.ipython_view.ConsoleView._changeLine (   self,
  text 
)
private

Replace currently entered command line with given text.

Parameters
textText to use as replacement.
Returns
none

Definition at line 457 of file ipython_view.py.

References visualizer.ipython_view.ConsoleView._write(), delete, visualizer.ipython_view.ConsoleView.line_start, and visualizer.ipython_view.ConsoleView.text_buffer.

Referenced by visualizer.ipython_view.ConsoleView.changeLine().

◆ _showPrompt()

def visualizer.ipython_view.ConsoleView._showPrompt (   self,
  prompt 
)
private

◆ _showReturned()

def visualizer.ipython_view.ConsoleView._showReturned (   self,
  text 
)
private

◆ _write()

def visualizer.ipython_view.ConsoleView._write (   self,
  text,
  editable = False 
)
private

◆ changeLine()

def visualizer.ipython_view.ConsoleView.changeLine (   self,
  text 
)

Replace currently entered command line with given text.

Parameters
textText to use as replacement.
Returns
none

Definition at line 448 of file ipython_view.py.

References visualizer.ipython_view.ConsoleView._changeLine().

Referenced by visualizer.ipython_view.IPythonView.onKeyPressExtend().

◆ getCurrentLine()

def visualizer.ipython_view.ConsoleView.getCurrentLine (   self)

Get text in current command line.

Returns
Text of current command line.

Definition at line 469 of file ipython_view.py.

References visualizer.ipython_view.ConsoleView.line_start, and visualizer.ipython_view.ConsoleView.text_buffer.

Referenced by visualizer.ipython_view.IPythonView.onKeyPressExtend(), and visualizer.ipython_view.IPythonView.raw_input().

◆ onKeyPress()

def visualizer.ipython_view.ConsoleView.onKeyPress (   self,
  widget,
  event 
)

Key press callback used for correcting behavior for console-like interfaces.

For example 'home' should go to prompt, not to beginning of line.

Parameters
widgetWidget that key press accored in.
eventEvent object
Returns
Return True if event should not trickle.

Definition at line 513 of file ipython_view.py.

References visualizer.ipython_view.ConsoleView.line_start, visualizer.ipython_view.ConsoleView.onKeyPressExtend(), and visualizer.ipython_view.ConsoleView.text_buffer.

◆ onKeyPressExtend()

def visualizer.ipython_view.ConsoleView.onKeyPressExtend (   self,
  event 
)

For some reason we can't extend onKeyPress directly (bug #500900).

Parameters
eventkey press
Returns
none

Definition at line 556 of file ipython_view.py.

Referenced by visualizer.ipython_view.ConsoleView.onKeyPress().

◆ showPrompt()

def visualizer.ipython_view.ConsoleView.showPrompt (   self,
  prompt 
)

Prints prompt at start of line.

Parameters
promptPrompt to print.
Returns
none

Definition at line 428 of file ipython_view.py.

References visualizer.ipython_view.ConsoleView._showPrompt().

Referenced by visualizer.ipython_view.IPythonView.onKeyPressExtend().

◆ showReturned()

def visualizer.ipython_view.ConsoleView.showReturned (   self,
  text 
)

Show returned text from last command and print new prompt.

Parameters
textText to show.
Returns
none

Definition at line 480 of file ipython_view.py.

References visualizer.ipython_view.ConsoleView._showReturned().

◆ write()

def visualizer.ipython_view.ConsoleView.write (   self,
  text,
  editable = False 
)

Write given text to buffer.

Parameters
textText to append.
editableIf true, added text is editable.
Returns
none

Definition at line 389 of file ipython_view.py.

References visualizer.ipython_view.ConsoleView._write().

Referenced by visualizer.ipython_view.IPythonView.onKeyPressExtend().

Member Data Documentation

◆ ANSI_COLORS

visualizer.ipython_view.ConsoleView.ANSI_COLORS
static
Initial value:
= {'0;30': 'Black', '0;31': 'Red',
'0;32': 'Green', '0;33': 'Brown',
'0;34': 'Blue', '0;35': 'Purple',
'0;36': 'Cyan', '0;37': 'LightGray',
'1;30': 'DarkGray', '1;31': 'DarkRed',
'1;32': 'SeaGreen', '1;33': 'Yellow',
'1;34': 'LightBlue', '1;35': 'MediumPurple',
'1;36': 'LightCyan', '1;37': 'White'}

color list

Definition at line 357 of file ipython_view.py.

◆ color_pat

visualizer.ipython_view.ConsoleView.color_pat

color pattern

Definition at line 383 of file ipython_view.py.

Referenced by visualizer.ipython_view.ConsoleView._write().

◆ line_start

visualizer.ipython_view.ConsoleView.line_start

◆ mark

visualizer.ipython_view.ConsoleView.mark

scroll mark

Definition at line 374 of file ipython_view.py.

Referenced by visualizer.ipython_view.ConsoleView._write().

◆ text_buffer

visualizer.ipython_view.ConsoleView.text_buffer

The documentation for this class was generated from the following file: