trikRuntime
|
Executes scripts in Python Engine. More...
#include <trikPythonRunner.h>
Public Slots | |
void | run (const QString &script, const QString &fileName="") override |
void | runDirectCommand (const QString &command) override |
void | abort () override |
void | brickBeep () override |
Public Slots inherited from trikScriptRunner::TrikScriptRunnerInterface | |
virtual void | run (const QString &script, const QString &fileName="")=0 |
Executes given script asynchronously. More... | |
virtual void | runDirectCommand (const QString &command)=0 |
Executes given script as direct command, so it will use existing script execution environment (or create one if needed) and will not reset execution state before or after execution. More... | |
virtual void | abort ()=0 |
Aborts script execution. More... | |
virtual void | brickBeep ()=0 |
Plays "beep" sound. More... | |
Public Member Functions | |
TrikPythonRunner (trikControl::BrickInterface &brick, trikNetwork::MailboxInterface *mailbox) | |
Constructor. More... | |
~TrikPythonRunner () override | |
void | registerUserFunction (const QString &name, QScriptEngine::FunctionSignature function) override |
Registers given C++ function as callable from script, with given name. More... | |
void | addCustomEngineInitStep (const std::function< void(QScriptEngine *)> &step) override |
Adds custom initialization steps when creating script engine (useful when used from outside of the TrikRuntime). More... | |
QStringList | knownMethodNames () const override |
Gets all method names from executive objects (brick, script, etc.) from ScriptEngineWorker (useful when used from outside of the TrikRuntime). More... | |
bool | wasError () override |
Get status of last direct command/script. More... | |
Additional Inherited Members | |
Signals inherited from trikScriptRunner::TrikScriptRunnerInterface | |
void | completed (const QString &error, int scriptId) |
Emitted when current script completes execution (for event-driven mode it means that script requested to quit or was aborted). More... | |
void | startedScript (const QString &fileName, int scriptId) |
Emitted when new script from file started. More... | |
void | startedDirectScript (int scriptId) |
Emitted when new direct script started. More... | |
void | sendMessage (const QString &text) |
Emitted when a message must be sent to a desktop. More... | |
Executes scripts in Python Engine.
TrikPythonRunner::TrikPythonRunner | ( | trikControl::BrickInterface & | brick, |
trikNetwork::MailboxInterface * | mailbox | ||
) |
Constructor.
brick | - reference to trikControl::Brick instance. |
mailbox | - mailbox object used to communicate with other robots. |
|
override |
|
overrideslot |
|
overridevirtual |
Adds custom initialization steps when creating script engine (useful when used from outside of the TrikRuntime).
Implements trikScriptRunner::TrikScriptRunnerInterface.
|
overrideslot |
|
overridevirtual |
Gets all method names from executive objects (brick, script, etc.) from ScriptEngineWorker (useful when used from outside of the TrikRuntime).
Implements trikScriptRunner::TrikScriptRunnerInterface.
|
overridevirtual |
Registers given C++ function as callable from script, with given name.
Implements trikScriptRunner::TrikScriptRunnerInterface.
|
overrideslot |
|
overrideslot |
|
overridevirtual |
Get status of last direct command/script.
Implements trikScriptRunner::TrikScriptRunnerInterface.