Convenience class for accessing Python interpreter.
More...
#include <PythonInterpreter.h>
|
void | executeString (QString const &string) |
|
int | runFile (QString const &filePath) |
|
virtual void | write (QString const &command) override final |
|
Convenience class for accessing Python interpreter.
Definition at line 28 of file PythonInterpreter.h.
◆ PythonInterpreter()
PythonInterpreter::PythonInterpreter |
( |
WriteChannel * | outputChannel, |
|
|
WriteChannel * | errorChannel, |
|
|
bool | printPromt = true, |
|
|
QObject * | parent = nullptr ) |
|
explicit |
The constructor.
- Parameters
-
[in] | outputChannel | Channel for standard messages and interpreter output. |
[in] | errorChannel | Channel for error messages. |
[in] | printPromt | Flag for enabling prompt printing. |
[in] | parent | The parent object. |
Definition at line 24 of file PythonInterpreter.cpp.
◆ ~PythonInterpreter()
PythonInterpreter::~PythonInterpreter |
( |
| ) |
|
|
finaldefault |
◆ execute()
void PythonInterpreter::execute |
( |
std::string const & | line | ) |
|
Execute a single line in the interpreter.
- Parameters
-
[in] | line | The line to execute. |
Definition at line 91 of file PythonInterpreter.cpp.
◆ executeDone
void PythonInterpreter::executeDone |
( |
| ) |
|
|
signal |
◆ executeString
void PythonInterpreter::executeString |
( |
QString const & | string | ) |
|
|
slot |
Execute the given arbitrary long string in the interpreter.
- Parameters
-
[in] | string | The string to execute. |
Definition at line 182 of file PythonInterpreter.cpp.
◆ finalize()
void PythonInterpreter::finalize |
( |
| ) |
|
◆ initialize()
bool PythonInterpreter::initialize |
( |
bool | interactive = true | ) |
|
Initializes the interpreter. This function must be called before writing any commands with write().
- Parameters
-
[in] | interactive | Flag for enabling interactive std input. Set to true on command-line. |
- Returns
- True, if initialization was successful, otherwise false.
Definition at line 38 of file PythonInterpreter.cpp.
◆ runFile
int PythonInterpreter::runFile |
( |
QString const & | filePath | ) |
|
|
slot |
Run a script from a given file.
- Parameters
-
[in] | filePath | Path to the file to run. |
- Returns
- Return value of the script or 1 if script file couldn't be opened.
Definition at line 205 of file PythonInterpreter.cpp.
◆ write
void PythonInterpreter::write |
( |
QString const & | command | ) |
|
|
finaloverridevirtualslot |
Write a command for interpreter to execute.
- Parameters
-
[in] | command | The command to execute. |
Definition at line 83 of file PythonInterpreter.cpp.
The documentation for this class was generated from the following files: