trikRuntime
trikScriptRunner::TrikPythonRunner Class Reference

Executes scripts in Python Engine. More...

#include <trikPythonRunner.h>

Inheritance diagram for trikScriptRunner::TrikPythonRunner:
Collaboration diagram for trikScriptRunner::TrikPythonRunner:

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...
 

Detailed Description

Executes scripts in Python Engine.

Constructor & Destructor Documentation

TrikPythonRunner::TrikPythonRunner ( trikControl::BrickInterface brick,
trikNetwork::MailboxInterface mailbox 
)

Constructor.

Parameters
brick- reference to trikControl::Brick instance.
mailbox- mailbox object used to communicate with other robots.
TrikPythonRunner::~TrikPythonRunner ( )
override

Member Function Documentation

void TrikPythonRunner::abort ( )
overrideslot
void TrikPythonRunner::addCustomEngineInitStep ( const std::function< void(QScriptEngine *)> &  step)
overridevirtual

Adds custom initialization steps when creating script engine (useful when used from outside of the TrikRuntime).

Implements trikScriptRunner::TrikScriptRunnerInterface.

void TrikPythonRunner::brickBeep ( )
overrideslot
QStringList TrikPythonRunner::knownMethodNames ( ) const
overridevirtual

Gets all method names from executive objects (brick, script, etc.) from ScriptEngineWorker (useful when used from outside of the TrikRuntime).

Implements trikScriptRunner::TrikScriptRunnerInterface.

void TrikPythonRunner::registerUserFunction ( const QString &  name,
QScriptEngine::FunctionSignature  function 
)
overridevirtual

Registers given C++ function as callable from script, with given name.

Implements trikScriptRunner::TrikScriptRunnerInterface.

void TrikPythonRunner::run ( const QString &  script,
const QString &  fileName = "" 
)
overrideslot
void TrikPythonRunner::runDirectCommand ( const QString &  command)
overrideslot
bool TrikPythonRunner::wasError ( )
overridevirtual

Get status of last direct command/script.

Implements trikScriptRunner::TrikScriptRunnerInterface.


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