eye.widgets.eval_console module

Interactive Python evaluator console

class eye.widgets.eval_console.EvalConsole(**kwargs)[source]

Bases: QWidget, WidgetMixin

Interactive evaluator console widget

Text typed in the console will be executed as Python code, in the context of the EYE app, which allows to do some operations on widgets directly from this console.

The editor variable is automatically set to the last focused editor widget in the current window. The window variable is set to current window. The eye module is imported, and so are the submodules already imported by the configuration files.

During execution of a line, stdout and stderr are captured and are output to this widget console. Do not execute statemements taking a lot of time as it would freeze the UI.

This widget can typically added as a dock widget.

eventFilter(obj, event)[source]
exec_code(code)[source]

This slot has signature exec_code(str).

import_all_qt()[source]
protect_namespace()[source]
set_namespace()[source]
eye.widgets.eval_console.NAMESPACE = {'reload': <function reload>}

Additional shared namespace between all EvalConsole objects.

Example:

def hello():
        print('Hello world')

eye.widgets.eval_console.NAMESPACE['hello'] = hello

Then, the hello() function can be called in the console.

eye.widgets.eval_console.register_console_symbol(name=None)[source]

Decorator to register a function on the eval console

Example:

@register_console_symbol('foo')
def foo():
        pass

Is equivalent to:

def foo():
        pass

NAMESPACE['foo'] = foo