Developer Documentation
Loading...
Searching...
No Matches
PythonInterpreter Class Reference

This class provides OpenFlippers Python interpreter. More...

#include <OpenFlipper/PythonInterpreter/PythonInterpreter.hh>

Inheritance diagram for PythonInterpreter:

Signals

void log (Logtype _type, QString _message)
 Log with OUT,WARN or ERR as type.
 

Public Member Functions

bool runScript (const QString &_script)
 Run a script. Output is passed to the standard logging facilities of OpenFlipper.
 
QString runScriptOutput (const QString &_script)
 

Static Public Member Functions

static PythonInterpretergetInstance ()
 Creates or returns an instance of the interpreter.
 

Private Member Functions

 PythonInterpreter ()
 private constructor because of singleton
 
void initPython ()
 Initialize OpenFlipper Python Interpreter.
 
void resetInterpreter ()
 Resets the interpreter and all states.
 
bool modulesInitialized ()
 
void pyOutput (const char *w)
 Callback to redirect cout log to OpenFlipper logger.
 
void pyError (const char *w)
 Callback to redirect cerr log to OpenFlipper logger.
 

Private Attributes

bool externalLogging_
 
QString LogErr
 
QString LogOut
 

Detailed Description

This class provides OpenFlippers Python interpreter.

Definition at line 49 of file PythonInterpreter.hh.

Constructor & Destructor Documentation

◆ ~PythonInterpreter()

PythonInterpreter::~PythonInterpreter ( )

Definition at line 95 of file PythonInterpreter.cc.

◆ PythonInterpreter()

PythonInterpreter::PythonInterpreter ( )
private

private constructor because of singleton

Definition at line 89 of file PythonInterpreter.cc.

Member Function Documentation

◆ getInstance()

PythonInterpreter * PythonInterpreter::getInstance ( )
static

Creates or returns an instance of the interpreter.

There will only be one instance of the PythonInterpreter to ensure that we only run one context.

Returns

Definition at line 78 of file PythonInterpreter.cc.

◆ initPython()

void PythonInterpreter::initPython ( )
private

Initialize OpenFlipper Python Interpreter.

Definition at line 104 of file PythonInterpreter.cc.

◆ modulesInitialized()

bool PythonInterpreter::modulesInitialized ( )
private

@TODO: Why does this work?

Definition at line 99 of file PythonInterpreter.cc.

◆ pyError()

void PythonInterpreter::pyError ( const char *  w)
private

Callback to redirect cerr log to OpenFlipper logger.

Parameters
wLog string

Definition at line 368 of file PythonInterpreter.cc.

◆ pyOutput()

void PythonInterpreter::pyOutput ( const char *  w)
private

Callback to redirect cout log to OpenFlipper logger.

Parameters
wLog string

Definition at line 359 of file PythonInterpreter.cc.

◆ resetInterpreter()

void PythonInterpreter::resetInterpreter ( )
private

Resets the interpreter and all states.

Definition at line 255 of file PythonInterpreter.cc.

◆ runScript()

bool PythonInterpreter::runScript ( const QString &  _script)

Run a script. Output is passed to the standard logging facilities of OpenFlipper.

Parameters
_script
Returns

Definition at line 268 of file PythonInterpreter.cc.

◆ runScriptOutput()

QString PythonInterpreter::runScriptOutput ( const QString &  _script)

\ brief run a script and return the output as a QString

Parameters
_script
Returns

Definition at line 348 of file PythonInterpreter.cc.

Member Data Documentation

◆ externalLogging_

bool PythonInterpreter::externalLogging_
private

Definition at line 119 of file PythonInterpreter.hh.

◆ LogErr

QString PythonInterpreter::LogErr
private

Definition at line 120 of file PythonInterpreter.hh.

◆ LogOut

QString PythonInterpreter::LogOut
private

Definition at line 121 of file PythonInterpreter.hh.


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