Mantid
Loading...
Searching...
No Matches
Public Member Functions | Private Attributes | List of all members
MantidQt::Widgets::Common::Python::CodeExecution Class Reference

The CodeExecution class support execution of arbitrary Python code with the option to install a trace handler to track lines executed and tell an editor to mark them appropriately. More...

#include <CodeExecution.h>

Public Member Functions

 CodeExecution (ScriptEditor *editor)
 Construct a LineTrackingExecutor for a given editor. More...
 
PyObject * execute (const QString &codeStr, const QString &filename, int flags, PyObject *globals, int lineOffset) const
 Execute the code string from the given filename and return the result. More...
 

Private Attributes

ScriptEditorm_editor {nullptr}
 

Detailed Description

The CodeExecution class support execution of arbitrary Python code with the option to install a trace handler to track lines executed and tell an editor to mark them appropriately.

Definition at line 22 of file CodeExecution.h.

Constructor & Destructor Documentation

◆ CodeExecution()

MantidQt::Widgets::Common::Python::CodeExecution::CodeExecution ( ScriptEditor editor)

Construct a LineTrackingExecutor for a given editor.

Parameters
editorA pointer to an editor. Can be nullptr. Disables progress tracking.

Definition at line 61 of file CodeExecution.cpp.

Member Function Documentation

◆ execute()

PyObject * MantidQt::Widgets::Common::Python::CodeExecution::execute ( const QString &  codeStr,
const QString &  filename,
int  flags,
PyObject *  globals,
int  lineOffset 
) const

Execute the code string from the given filename and return the result.

Parameters
codeStrA string containing the source code
filenameA string containing the filename of the source code
flagsAn OR-ed combination of compiler flags
globalsA dictionary containing the current globals mapping
lineOffsetThe number of lines offset to apply to the marker

Definition at line 71 of file CodeExecution.cpp.

References CODE_OBJECT, and m_editor.

Member Data Documentation

◆ m_editor

ScriptEditor* MantidQt::Widgets::Common::Python::CodeExecution::m_editor {nullptr}
private

Definition at line 29 of file CodeExecution.h.

Referenced by execute().


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