ParaView
Public Slots | Signals | Public Member Functions | Protected Slots | Protected Member Functions | List of all members
pqPythonManager Class Reference

pqPythonManager is a class to facilitate the use of a python interpreter by various paraview GUI components. More...

#include <pqPythonManager.h>

Inherits QObject.

Public Slots

void executeScript (const QString &filename)
 Executes the given script. More...
 
void executeScriptAndRender (const QString &filename)
 Same as executeScript() except that is also triggers a render on all views in the application after the script has been processed. More...
 
void editMacro (const QString &fileName)
 Launch python editor to edit the macro. More...
 
void updateStatusMessage ()
 Print on the status bar "Python Trace is currently ON" if currently tracing... More...
 

Signals

void paraviewPythonModulesImported ()
 

Public Member Functions

 pqPythonManager (QObject *parent=NULL)
 
virtual ~pqPythonManager ()
 
bool interpreterIsInitialized ()
 Returns true if the interpreter has been initialized. More...
 
pqPythonDialogpythonShellDialog ()
 Return the python shell dialog. More...
 
void editTrace (const QString &txt=QString(), bool update=false)
 Show the python editor with the trace in it. More...
 
void addMacro (const QString &fileName)
 Save the macro in ParaView configuration and update widget automatically. More...
 
void updateMacroList ()
 Invalidate the macro list, so the menu/toolbars are updated according to the content of the Macros directories... More...
 
void addWidgetForRunMacros (QWidget *widget)
 Add a widget to be given macro actions. More...
 
void addWidgetForEditMacros (QWidget *widget)
 Add a widget to be given macro actions. More...
 
void addWidgetForDeleteMacros (QWidget *widget)
 Add a widget to be given macro actions. More...
 

Protected Slots

void onRemovingServer (pqServer *server)
 Whenever we are about to disconnect from a server, we "reset" the Python shell, if created. More...
 

Protected Member Functions

QString getTraceString ()
 

Detailed Description

pqPythonManager is a class to facilitate the use of a python interpreter by various paraview GUI components.

The manager has a single instance of the pqPythonDialog. Currently the pqPythonDialog "owns" the python interpreter. Anyone who wants to execute python code should call pythonShellDialog() to get a pointer to the pqPythonDialog instance. This manager class provides global access to the python dialog and methods to ensure the python dialog's interpreter stays in sync with the current active server.

Note: because the interpreter is initialized lazily, a number of the member functions on this class have the side effect of initializing the python interpreter first.

Definition at line 57 of file pqPythonManager.h.

Constructor & Destructor Documentation

◆ pqPythonManager()

pqPythonManager::pqPythonManager ( QObject *  parent = NULL)

◆ ~pqPythonManager()

virtual pqPythonManager::~pqPythonManager ( )
virtual

Member Function Documentation

◆ interpreterIsInitialized()

bool pqPythonManager::interpreterIsInitialized ( )

Returns true if the interpreter has been initialized.

◆ pythonShellDialog()

pqPythonDialog* pqPythonManager::pythonShellDialog ( )

Return the python shell dialog.

This will cause the interpreter to be initialized if it has not been already.

◆ addWidgetForRunMacros()

void pqPythonManager::addWidgetForRunMacros ( QWidget *  widget)

Add a widget to be given macro actions.

QActions representing script macros will be added to the widget. This could be a QToolBar, QMenu, or other type of widget.

◆ addWidgetForEditMacros()

void pqPythonManager::addWidgetForEditMacros ( QWidget *  widget)

Add a widget to be given macro actions.

QActions representing script macros will be added to the widget. This could be a QToolBar, QMenu, or other type of widget.

◆ addWidgetForDeleteMacros()

void pqPythonManager::addWidgetForDeleteMacros ( QWidget *  widget)

Add a widget to be given macro actions.

QActions representing script macros will be added to the widget. This could be a QToolBar, QMenu, or other type of widget.

◆ editTrace()

void pqPythonManager::editTrace ( const QString &  txt = QString(),
bool  update = false 
)

Show the python editor with the trace in it.

If txt is empty, the editor will obtain the state from active vtkSMTrace instance, if any.

◆ addMacro()

void pqPythonManager::addMacro ( const QString &  fileName)

Save the macro in ParaView configuration and update widget automatically.

◆ updateMacroList()

void pqPythonManager::updateMacroList ( )

Invalidate the macro list, so the menu/toolbars are updated according to the content of the Macros directories...

◆ paraviewPythonModulesImported

void pqPythonManager::paraviewPythonModulesImported ( )
signal

◆ executeScript

void pqPythonManager::executeScript ( const QString &  filename)
slot

Executes the given script.

If the python interpreter hasn't been initialized yet it will be initialized.

◆ executeScriptAndRender

void pqPythonManager::executeScriptAndRender ( const QString &  filename)
slot

Same as executeScript() except that is also triggers a render on all views in the application after the script has been processed.

This is used when playing back macros, for example.

◆ editMacro

void pqPythonManager::editMacro ( const QString &  fileName)
slot

Launch python editor to edit the macro.

◆ updateStatusMessage

void pqPythonManager::updateStatusMessage ( )
slot

Print on the status bar "Python Trace is currently ON" if currently tracing...

◆ onRemovingServer

void pqPythonManager::onRemovingServer ( pqServer server)
protectedslot

Whenever we are about to disconnect from a server, we "reset" the Python shell, if created.

This will ensure all Python objects created by the shell are released.

◆ getTraceString()

QString pqPythonManager::getTraceString ( )
protected

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