Mantid
Loading...
Searching...
No Matches
Signals | Public Member Functions | Static Public Member Functions | List of all members
MantidQt::API::PythonRunner Class Reference

This is the base class all customised user interfaces that do not wish to be tied to a specific Mantid algorithm but rather customised for user's requirements. More...

#include <PythonRunner.h>

Inheritance diagram for MantidQt::API::PythonRunner:

Signals

void runAsPythonScript (const QString &code, bool)
 

Public Member Functions

 PythonRunner ()
 Default constructor. More...
 
QString runPythonCode (const QString &code, bool no_output=false)
 Run python code. More...
 

Static Public Member Functions

static const QString stringList2Tuple (const QStringList &list)
 Converts a list of strings into a string recognised by Python as a tuple. More...
 

Detailed Description

This is the base class all customised user interfaces that do not wish to be tied to a specific Mantid algorithm but rather customised for user's requirements.

Author
Steve Williams, Rutherford Appleton Laboratory
Date
10/11/2010

Definition at line 26 of file PythonRunner.h.

Constructor & Destructor Documentation

◆ PythonRunner()

MantidQt::API::PythonRunner::PythonRunner ( )
inline

Default constructor.

Definition at line 31 of file PythonRunner.h.

Member Function Documentation

◆ runAsPythonScript

void MantidQt::API::PythonRunner::runAsPythonScript ( const QString &  code,
bool   
)
signal

Referenced by runPythonCode().

◆ runPythonCode()

QString PythonRunner::runPythonCode ( const QString &  code,
bool  no_output = false 
)

Run python code.

Run a piece of python code and return any output that it writes to stdout.

Parameters
code:: the Python commands to execute
no_output:: if set to true this method returns an empty string, if false it returns the output from any Python print statements
Returns
output from Python print statements unless no_output is false

Definition at line 31 of file PythonRunner.cpp.

References Mantid::Kernel::Logger::debug(), Mantid::Kernel::Logger::is(), and runAsPythonScript().

Referenced by MantidQt::API::MantidDialog::runPythonCode(), MantidQt::API::MantidWidget::runPythonCode(), and MantidQt::API::UserSubWindow::runPythonCode().

◆ stringList2Tuple()

const QString PythonRunner::stringList2Tuple ( const QStringList &  list)
static

Converts a list of strings into a string recognised by Python as a tuple.

This Python helper function converts a list of strings into one string that Python will recognise as a Python tuple.

Parameters
liststring entries
Returns
the strings as a comma separated list in brakets

Definition at line 76 of file PythonRunner.cpp.


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