-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathgt_python.h
More file actions
210 lines (174 loc) · 5.4 KB
/
gt_python.h
File metadata and controls
210 lines (174 loc) · 5.4 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
/* GTlab - Gas Turbine laboratory
* Source File:
*
* SPDX-License-Identifier: Apache-2.0
* SPDX-FileCopyrightText: 2024 German Aerospace Center (DLR)
*
* Created on: 12.08.2019
* Author: Stanislaus Reitenbach (AT-TWK)
*/
#ifndef GTPYTHON_H
#define GTPYTHON_H
#include "gt_pythonmodule_exports.h"
#include "gt_moduleinterface.h"
#include "gt_processinterface.h"
#include "gt_mdiinterface.h"
#include "gt_collectioninterface.h"
#include "gt_networkinterface.h"
#include "gt_globals.h"
#if GT_VERSION >= GT_VERSION_CHECK(1, 7, 0)
#include "gt_versionnumber.h"
#endif
#if GT_VERSION < GT_VERSION_CHECK(2, 0, 0)
#include "gt_initmoduleinterface.h"
#else
#include "gt_commandlinefunction.h"
#endif
#include "gt_compat.h"
/**
* @brief The GtPythonModule class
*/
class GtPythonModule: public QObject, public GtModuleInterface,
public GtProcessInterface, public GtMdiInterface,
public GtCollectionInterface, public GtNetworkInterface
#if GT_VERSION < GT_VERSION_CHECK(2, 0, 0)
, public GtInitModuleInterface
#endif
{
Q_OBJECT
#if GT_VERSION < GT_VERSION_CHECK(2, 0, 0)
GT_MODULE("gt_python_1_7.json") // cppcheck-suppress syntaxError
#else
GT_MODULE("gt_python.json") // cppcheck-suppress syntaxError
#endif
Q_INTERFACES(GtModuleInterface)
Q_INTERFACES(GtProcessInterface)
Q_INTERFACES(GtMdiInterface)
Q_INTERFACES(GtCollectionInterface)
Q_INTERFACES(GtNetworkInterface)
#if GT_VERSION < GT_VERSION_CHECK(2, 0, 0)
Q_INTERFACES(GtInitModuleInterface)
#endif
public:
/**
* @brief Returns current version number of datamodel extension
* @return version number
*/
#if GT_VERSION >= GT_VERSION_CHECK(1, 7, 0)
GtVersionNumber version() override;
#else
int version() override;
#endif
/**
* @brief Returns module description
* @return description
*/
QString description() const override;
#if GT_VERSION >= GT_VERSION_CHECK(2, 0, 0)
/**
* @brief metaInformation
* @return baic meta information about the module
*/
MetaInformation metaInformation() const override;
#endif
/**
* @brief Initializes module. Called on application startup.
*/
void init() override;
/**
* @brief Returns static meta objects of calculator classes.
* @return list including meta objects
*/
QList<GtCalculatorData> calculators() override;
/**
* @brief Returns static meta objects of task classes.
* @return list including meta objects
*/
QList<GtTaskData> tasks() override;
/**
* @brief Returns static meta objects of mdi item classes.
* @return list including meta objects
*/
QList<QMetaObject> mdiItems() override;
/**
* @brief Returns static meta objects of dockwidget classes.
* @return list including meta objects
*/
QList<QMetaObject> dockWidgets() override;
/**
* @brief uiItems
* @return
*/
QMap<const char*, QMetaObject> uiItems() override;
/**
* @brief postItems
* @return
*/
virtual QList<QMetaObject> postItems() override;
/**
* @brief postPlots
* @return
*/
QList<QMetaObject> postPlots() override;
/**
* @brief Returns collection specific icon.
* @return Collection spezific icon.
*/
QIcon collectionIcon() const override;
/**
* @brief Returns identification string of collection. Same id
* is used to generate access point data within the netowrk interface.
* @return Identification string of collection.
*/
QString collectionId() const override;
/**
* @brief Returns meta object of GtAbstractCollectionSettings class.
* @return Meta object of GtAbstractCollectionSettings class.
*/
QMetaObject collectionSettings() const override;
/**
* @brief Returns structure of collection items.
* @return Sturcture of collection items.
*/
QMap<QString, QMetaType::Type> collectionStructure() const override;
/**
* @brief Returns identification string of access point.
* @return Identification string of access point.
*/
QString accessId() override;
/**
* @brief Returns meta object of GtAbstractAccessDataConnection class.
* @return Meta object of GtAbstractAccessDataConnection class.
*/
QMetaObject accessConnection() override;
#if GT_VERSION >= GT_VERSION_CHECK(2, 0, 0)
/**
* @brief metaInformation
* @return baic meta information about the module
*/
QList<GtCommandLineFunction> commandLineFunctions() const override;
QList<gt::SharedFunction> sharedFunctions() const override;
/** We are providing routines to upgrade the datamodel */
QList<gt::VersionUpgradeRoutine> upgradeRoutines() const override;
#endif
private:
/**
* @brief Searches recursively for widget based on given objectName path.
* If parent is not set, current top level widgets of application
* are analysed.
* @param path Hierarchical path of objectName strings.
* @return Widget found based on given objectName path. returns NULL if
* widget was not found.
*/
QWidget* findWidget(QStringList path, QWidget* parent = nullptr);
};
namespace PythonExecution
{
/**
* @brief Runs a standalone python interpreter given the file passed in args
* @param args The first parameter is the file to execute
* @return 0 on success, -1 otherwise
*/
GT_PYTHON_EXPORT int runPythonInterpreter(const QStringList& args);
}
#endif // GTPYTHON_H