Embedded Python

From ParaQ Wiki
Jump to navigationJump to search

Overview

For development and troubleshooting purposes only, a Python interpreter has been embedded in the Qt client. This will allow developers to query the internal state of the running client, without having to restart, set breakpoints in a debugger, etc. The embedded interpreter will not have access to UI state.

Design Details

Class pqConsole provides a generic Qt console interface widget that prints text to the screen and handles line-oriented user input. pqConsole also provides a command-history (accessible with up-arrow and down-arrow keys) and the ability to alter output text color and format.

Class pqPythonShell uses pqConsole to provide an interactive Python shell, by handling Python-specific behavior, e.g. prompts, multiple-line statements, and redirection of Python output to the console.

Obligatory Screenshots

A screenshot of the the interactive Python shell, using the ParaView Server Manager wrappings:

Embedded python2.png


The interactive Python interpreter running the canonical VTK cone demo - all three windows are part of a single Qt client process. Note: there's no value in using VTK in ParaQ this way, it's just to prove it can be done. You have to use the ParaView Server to get the benefits of parallel, distributed visualization!

Embedded python.png