Developer Documentation

Signals | Public Member Functions | Static Public Member Functions | Private Member Functions | Private Attributes | List of all members
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 (QString _script)
| Run a script. Output is passed to the standard logging facilities of OpenFlipper. More...
QString | runScriptOutput (QString _script)

## Static Public Member Functions
static PythonInterpreter * | getInstance ()
| Creates or returns an instance of the interpreter. More...

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

## 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 | ( |  | ) |
| 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

: 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

  w | Log string

Definition at line 329 of file PythonInterpreter.cc.

## ◆ pyOutput()

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

Callback to redirect cout log to OpenFlipper logger.

Parameters

  w | Log string

Definition at line 320 of file PythonInterpreter.cc.

## ◆ resetInterpreter()

void PythonInterpreter::resetInterpreter | ( |  | ) |
| private

Resets the interpreter and all states.

Definition at line 220 of file PythonInterpreter.cc.

## ◆ runScript()

bool PythonInterpreter::runScript | ( | QString | _script | ) |

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

Parameters

  _script |

Returns

Definition at line 233 of file PythonInterpreter.cc.

## ◆ runScriptOutput()

QString PythonInterpreter::runScriptOutput | ( | QString | _script | ) |

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

Parameters

  _script |

Returns

Definition at line 309 of file PythonInterpreter.cc.

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

- OpenFlipper/PythonInterpreter/PythonInterpreter.hh
- OpenFlipper/PythonInterpreter/PythonInterpreter.cc