openalea.vpltk.shell package

Submodules

openalea.vpltk.shell.ipythoninterpreter module

class openalea.vpltk.shell.ipythoninterpreter.Interpreter(gui='qt4', locals=None)[source]

Bases: IPython.kernel.inprocess.ipkernel.InProcessKernel

Interpreter is an IPython kernel adapted for OpenAlea.

Parameters:
  • gui – GUI to use. Default ‘qt4’.
  • locals – namespace to set to the interpreter. Default ‘None’.
openalea.vpltk.shell.ipythoninterpreter.main()[source]

openalea.vpltk.shell.ipythonshell module

class openalea.vpltk.shell.ipythonshell.ShellWidget(interpreter, message='', log='', parent=None)[source]

Bases: IPython.qt.console.rich_ipython_widget.RichIPythonWidget, openalea.vpltk.shell.streamredirection.GraphicalStreamRedirection

ShellWidget is an IPython shell.

get_interpreter()[source]
Returns:the interpreter object
loadcode(source=None, namespace=None)[source]

Load ‘source’ and use ‘namespace’ if it is in parameter. Else use locals.

Parameters:
  • source – text (string) to load
  • namespace – dict to use to execute the source
push(var)[source]

Push variables in the namespace. :param var: dict of objects

runcode(source=None, hidden=False, interactive=False)[source]

TODO

runsource(source=None, filename='<input>', symbol='single', hidden=False, interactive=False)[source]

TODO

write(txt)[source]

Write a text in the stdout of the shell and flush it. :param txt: String to write.

openalea.vpltk.shell.ipythonshell.main()[source]

openalea.vpltk.shell.scishell module

This module implements a QT4 python interpreter widget.

class openalea.vpltk.shell.scishell.SciShell(interpreter, message='', log='', parent=None)[source]

Bases: PyQt4.Qsci.QsciScintilla, openalea.vpltk.shell.streamredirection.GraphicalStreamRedirection

SciShell is a Python shell based in QScintilla. It is inspired by PyCute (pycute.py) : http://gerard.vermeulen.free.fr (GPL) and Eric4 shell (shell.py) : http://www.die-offenbachs.de/eric/index.html (GPL)

clear()[source]

Clear shell

contextMenuEvent(e)[source]
customEvent(event)[source]
dragEnterEvent(event)[source]
dragMoveEvent(event)[source]
dropEvent(event)[source]
flush()[source]

Simulate stdin, stdout, and stderr.

focusNextPrevChild(next)[source]

Reimplemented to stop Tab moving to the next window.

While the user is entering a multi-line command, the movement to the next window by the Tab key being pressed is suppressed.

@param next next window @return flag indicating the movement

get_interpreter()[source]

Return the interpreter object

isatty()[source]

Simulate stdin, stdout, and stderr.

keyPressEvent(ev)[source]

Re-implemented to handle the user input a key at a time.

@param ev key event (QKeyEvent)

mousePressEvent(event)[source]

Protected method to handle the mouse press event.

@param event the mouse press event (QMouseEvent)

paste()[source]

Reimplemented slot to handle the paste action.

readline()[source]

Simulate stdin, stdout, and stderr.

write(s)[source]

Simulate stdin, stdout, and stderr.

openalea.vpltk.shell.shell module

This module implements a QT4 python interpreter widget.

class openalea.vpltk.shell.shell.PyCutExt(interpreter, message='', log='', parent=None)[source]

Bases: PyQt4.QtGui.QTextEdit, openalea.vpltk.shell.streamredirection.GraphicalStreamRedirection

PyCute is a Python shell for PyQt.

Creating, displaying and controlling PyQt widgets from the Python command line interpreter is very hard, if not, impossible. PyCute solves this problem by interfacing the Python interpreter to a PyQt widget.

This class is inspired by PyCute.py : http://gerard.vermeulen.free.fr (GPL)

clear()[source]

Clear

color_line()[source]

Color the current line

contentsContextMenuEvent(ev)[source]

Suppress the right button context menu.

customEvent(event)[source]
dragEnterEvent(event)[source]
dragMoveEvent(event)[source]
dropEvent(event)[source]
fakeUser(lines)[source]

Simulate a user: lines is a sequence of strings, (Python statements).

flush()[source]

Simulate stdin, stdout, and stderr.

get_interpreter()[source]

Return the interpreter object

isatty()[source]

Simulate stdin, stdout, and stderr.

keyPressEvent(e)[source]

Handle user input a key at a time.

mousePressEvent(e)[source]

Keep the cursor after the last prompt.

moveCursor(operation, mode=0)[source]

Convenience function to move the cursor This function will be present in PyQT4.2

readline()[source]

Simulate stdin, stdout, and stderr.

write(text)[source]

Simulate stdin, stdout, and stderr.

writelines(text)[source]

Simulate stdin, stdout, and stderr.

class openalea.vpltk.shell.shell.SyntaxColor[source]

Allow to color python keywords

get_color(word)[source]

Return a color tuple (R,G,B) depending of the string word

is_python_string(str)[source]

Return True if str is enclosed by a string mark

keywords = set(['and', 'elif', 'is', 'global', 'as', 'in', 'if', 'from', 'raise', 'for', 'except', 'finally', 'print', 'import', 'pass', 'return', 'exec', 'else', 'break', 'not', 'with', 'class', 'assert', 'yield', 'try', 'while', 'continue', 'del', 'or', 'def', 'lambda'])
openalea.vpltk.shell.shell.get_interpreter_class()[source]
Returns:the interpreter class to instantiate the shell
openalea.vpltk.shell.shell.get_shell_class()[source]
Returns:the shell class to instantiate
openalea.vpltk.shell.shell.main()[source]

openalea.vpltk.shell.streamredirection module

class openalea.vpltk.shell.streamredirection.GraphicalStreamRedirection[source]

Bases: object

Redirection of a stream as graphic output

customEvent(event)[source]

custom event processing. Redirection to write

flush()[source]
hasMultipleStdErrRedirection()[source]
hasMultipleStdOutRedirection()[source]
isNoneAsStdErrRedirection()[source]
isNoneAsStdOutRedirection()[source]
isSelfStdErrRedirection()[source]
isSelfStdOutRedirection()[source]
isSysStdErrRedirection()[source]
isSysStdOutRedirection()[source]
multipleStdErrRedirection(enabled=True)[source]

make multiple (sys.stderr/pyconsole) or single (pyconsole) redirection of stderr

multipleStdOutRedirection(enabled=True)[source]

make multiple (sys.stdout/pyconsole) or single (pyconsole) redirection of stdout

noneAsStdErrRedirection()[source]
noneAsStdOutRedirection()[source]
selfAsStdErrRedirection()[source]
selfAsStdOutRedirection()[source]
setOutputRedirection(selfoutput=True, sysoutput=True, outanderr=3)[source]
sysAsStdErrRedirection()[source]
sysAsStdOutRedirection()[source]
class openalea.vpltk.shell.streamredirection.MultipleRedirection(*streams)[source]

Bases: object

Dummy file which redirects stream to multiple file

flush()[source]
write(str)[source]

Emulate write function

class openalea.vpltk.shell.streamredirection.NoneOutput[source]

Bases: object

Dummy file which redirects stream to nothing

write(str)[source]

Emulate write function

class openalea.vpltk.shell.streamredirection.ThreadedRedirection(guistream)[source]

Bases: object

Dummy file which redirects stream to threaded gui output

flush()[source]
write(str)[source]

Emulate write function

Module contents