-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathgtpn_pythonscriptdialog.cpp
More file actions
61 lines (46 loc) · 1.24 KB
/
gtpn_pythonscriptdialog.cpp
File metadata and controls
61 lines (46 loc) · 1.24 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
/* GTlab - Gas Turbine laboratory
* Source File: gtpn_pythonscriptdialog.cpp
*
* SPDX-License-Identifier: Apache-2.0
* SPDX-FileCopyrightText: 2024 German Aerospace Center (DLR)
*
* Created on: 22.03.2024
* Author: Jens Schmeink (AT-TWK)
*/
#include <QVBoxLayout>
#include <QTextOption>
#include "gtpy_contextmanager.h"
#include "gtpy_scripteditorwidget.h"
#include "gtpn_pythonscriptdialog.h"
GtpnPythonScriptDialog::GtpnPythonScriptDialog(QWidget* parent)
{
setWindowTitle(tr("Config Python Node"));
auto* layout = new QVBoxLayout;
auto* contextManager = GtpyContextManager::instance();
m_context = contextManager->createNewContext(
GtpyContextManager::ScriptEditorContext);
m_editor = new GtpyScriptEditorWidget(m_context, this);
layout->addWidget(m_editor);
setLayout(layout);
}
GtpnPythonScriptDialog::~GtpnPythonScriptDialog()
{
GtpyContextManager::instance()->deleteContext(m_context);
}
QString
GtpnPythonScriptDialog::pythonScript()
{
if (!m_editor) return {};
return m_editor->script();
}
void
GtpnPythonScriptDialog::setScript(const QString& str)
{
if (!m_editor) return;
m_editor->setScript(str);
}
int
GtpnPythonScriptDialog::context() const
{
return m_context;
}