Eidolon
Public Member Functions | Public Attributes | Private Member Functions | List of all members
ConsoleWidget Class Reference

Inherits QTextEdit.

Collaboration diagram for ConsoleWidget:
Collaboration graph

Public Member Functions

def __init__ (self, win, conf, parent=None)
 
def sendInputLine (self, line, historyAppend=True)
 
def sendInputBlock (self, block, printBlock=True)
 
def updateLocals (self, localvals)
 
def execute (self, line)
 
def write (self, line)
 
def flush (self)
 
def getCurrentLine (self)
 
def clearCurrentLine (self)
 
def focusOutEvent (self, event)
 
def keyReleaseEvent (self, event)
 
def insertFromMimeData (self, src)
 
def keyPressEvent (self, event)
 

Public Attributes

 win
 
 logfile
 
 locals
 
 comp
 
 inputlines
 
 linebuffer
 
 history
 
 historypos
 
 curline
 
 isExecuting
 
 initCmds
 
 isMetaDown
 
 metakeys
 
 metadown
 
 orig_stdout
 
 orig_stderr
 
 ps1
 
 ps2
 
 currentPrompt
 
 loglines
 
 thread
 

Private Member Functions

def _interpretThread (self)
 
def _setCursor (self, startline=False, endline=False)
 

Detailed Description

Simulates a Python terminal in a QTextEdit widget. This is similar to code.InteractiveConsole in how it executes
individual lines of source. It includes a basic session history feature.

Constructor & Destructor Documentation

◆ __init__()

def __init__ (   self,
  win,
  conf,
  parent = None 
)
Here is the call graph for this function:

Member Function Documentation

◆ _interpretThread()

def _interpretThread (   self)
private
Daemon thread method which prints the appropriate prompt and reads commands given through sendInputLine().
These are then executed with execute().
Here is the call graph for this function:

◆ _setCursor()

def _setCursor (   self,
  startline = False,
  endline = False 
)
private
Set the cursor to the appropriate position, ensuring it is on the last line, after the prompt. If 'startline'
is true or the cursor is somewhere not after the last prompt, the cursor is placed just after the last prompt.
If 'endline' is true then the cursor goes at the end of the last line.
Here is the caller graph for this function:

◆ clearCurrentLine()

def clearCurrentLine (   self)
Remove the current statement, leaving only the prompt
Here is the call graph for this function:
Here is the caller graph for this function:

◆ execute()

def execute (   self,
  line 
)
Compile and interpret the given Python statement. Returns true if more statements are expected to fill an
indented block, false otherwise.
Here is the call graph for this function:
Here is the caller graph for this function:

◆ flush()

def flush (   self)
Stream compatibility, does nothing.

◆ focusOutEvent()

def focusOutEvent (   self,
  event 
)

◆ getCurrentLine()

def getCurrentLine (   self)
Get the current statement being entered, minus the prompt
Here is the caller graph for this function:

◆ insertFromMimeData()

def insertFromMimeData (   self,
  src 
)
Triggered when pasting text, print out then interpret this line-by-line
Here is the call graph for this function:

◆ keyPressEvent()

def keyPressEvent (   self,
  event 
)
Interpret key presses and move the cursor as necessary. If enter/return is pressed, the current statement is
sent to be interpreted. Up and down cycle through the statement history. Usually the method of the superclass
is called but this is omitted when preserving correct cursor position for some keys (eg. backspace).
Here is the call graph for this function:

◆ keyReleaseEvent()

def keyReleaseEvent (   self,
  event 
)

◆ sendInputBlock()

def sendInputBlock (   self,
  block,
  printBlock = True 
)
Send a block of code lines `block' to be interpreted, printing the block to the console if `printBlock'.
Here is the call graph for this function:
Here is the caller graph for this function:

◆ sendInputLine()

def sendInputLine (   self,
  line,
  historyAppend = True 
)
Send the given line to the interpreter's line queue.
Here is the call graph for this function:
Here is the caller graph for this function:

◆ updateLocals()

def updateLocals (   self,
  localvals 
)
Override the local variable dictionary with the given dictionary.

◆ write()

def write (   self,
  line 
)
Write a line of text to the text window.
Here is the caller graph for this function:

Member Data Documentation

◆ comp

comp

◆ curline

curline

◆ currentPrompt

currentPrompt

◆ history

history

◆ historypos

historypos

◆ initCmds

initCmds

◆ inputlines

inputlines

◆ isExecuting

isExecuting

◆ isMetaDown

isMetaDown

◆ linebuffer

linebuffer

◆ locals

locals

◆ logfile

logfile

◆ loglines

loglines

◆ metadown

metadown

◆ metakeys

metakeys

◆ orig_stderr

orig_stderr

◆ orig_stdout

orig_stdout

◆ ps1

ps1

◆ ps2

ps2

◆ thread

thread

◆ win

win

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