trikRuntime
trikPythonRunner.h
Go to the documentation of this file.
1 /* Copyright 2014 CyberTech Labs Ltd.
2  *
3  * Licensed under the Apache License, Version 2.0 (the "License");
4  * you may not use this file except in compliance with the License.
5  * You may obtain a copy of the License at
6  *
7  * http://www.apache.org/licenses/LICENSE-2.0
8  *
9  * Unless required by applicable law or agreed to in writing, software
10  * distributed under the License is distributed on an "AS IS" BASIS,
11  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12  * See the License for the specific language governing permissions and
13  * limitations under the License. */
14 
15 #pragma once
16 
18 #include "trikPythonRunner.h"
19 
20 namespace trikNetwork {
21 class MailboxInterface;
22 }
23 
24 namespace trikControl {
25 class BrickInterface;
26 }
27 
28 
29 namespace trikScriptRunner {
30 
31 class PythonEngineWorker;
32 
35 {
36  Q_OBJECT
37 public:
43  );
44 
45  ~TrikPythonRunner() override;
46 
47  void registerUserFunction(const QString &name, QScriptEngine::FunctionSignature function) override;
48  void addCustomEngineInitStep(const std::function<void (QScriptEngine *)> &step) override;
49  QStringList knownMethodNames() const override;
50  bool wasError() override;
51 
52 public slots:
53  void run(const QString &script, const QString &fileName = "") override;
54  void runDirectCommand(const QString &command) override;
55  void abort() override;
56  void brickBeep() override;
57 
58 private slots:
60  void sendMessageFromMailBox(int senderNumber, const QString &message);
61 
62 private:
63 
65  PythonEngineWorker *mScriptEngineWorker { nullptr };
66  QThread mWorkerThread;
67 };
68 
69 }
Definition: trikCommunicator.h:23
Executes scripts in Python Engine.
Definition: trikPythonRunner.h:34
Definition: trikCommunicator.h:31
Interface for all script executors.
Definition: trikScriptRunnerInterface.h:100
Definition: trikCommunicator.h:27
Worker object to be run in a separate thread for Python execution.
Definition: pythonEngineWorker.h:33
Allows communication between robots.
Definition: mailboxInterface.h:31
script
Definition: system.py:83
Interface representing TRIK controller board and devices installed on it, also provides access to per...
Definition: brickInterface.h:46