Book a Demo!
CoCalc Logo Icon
StoreFeaturesDocsShareSupportNewsAboutPoliciesSign UpSign In
eclipse
GitHub Repository: eclipse/sumo
Path: blob/main/src/netedit/dialogs/run/GNERunPythonToolDialog.cpp
169684 views
1
/****************************************************************************/
2
// Eclipse SUMO, Simulation of Urban MObility; see https://eclipse.dev/sumo
3
// Copyright (C) 2001-2025 German Aerospace Center (DLR) and others.
4
// This program and the accompanying materials are made available under the
5
// terms of the Eclipse Public License 2.0 which is available at
6
// https://www.eclipse.org/legal/epl-2.0/
7
// This Source Code may also be made available under the following Secondary
8
// Licenses when the conditions for such availability set forth in the Eclipse
9
// Public License 2.0 are satisfied: GNU General Public License, version 2
10
// or later which is available at
11
// https://www.gnu.org/licenses/old-licenses/gpl-2.0-standalone.html
12
// SPDX-License-Identifier: EPL-2.0 OR GPL-2.0-or-later
13
/****************************************************************************/
14
/// @file GNERunPythonToolDialog.cpp
15
/// @author Pablo Alvarez Lopez
16
/// @date Mar 2023
17
///
18
// Dialog for running tools
19
/****************************************************************************/
20
21
#include <netedit/GNEApplicationWindow.h>
22
#include <netedit/GNEExternalRunner.h>
23
#include <netedit/tools/GNEPythonTool.h>
24
25
#include "GNERunPythonToolDialog.h"
26
27
// ============================================-===============================
28
// member method definitions
29
// ===========================================================================
30
31
GNERunPythonToolDialog::GNERunPythonToolDialog(GNEApplicationWindow* applicationWindow, GNEPythonTool* pythonTool) :
32
GNERunDialog(applicationWindow, TL("Python Tool"), GUIIcon::TOOL_PYTHON),
33
myPythonTool(pythonTool) {
34
// run tool
35
applicationWindow->getExternalRunner()->runTool(this);
36
// open modal dialog
37
openDialog();
38
}
39
40
41
GNERunPythonToolDialog::~GNERunPythonToolDialog() {}
42
43
44
void
45
GNERunPythonToolDialog::runInternalTest(const InternalTestStep::DialogArgument* /*dialogTest*/) {
46
// finish
47
}
48
49
50
std::string
51
GNERunPythonToolDialog::getRunCommand() const {
52
return myPythonTool->getCommand();
53
}
54
55
56
long
57
GNERunPythonToolDialog::onCmdBack(FXObject*, FXSelector, void*) {
58
// close runTool dialog and open tool dialog
59
onCmdClose(nullptr, 0, nullptr);
60
return myApplicationWindow->handle(myPythonTool->getMenuCommand(), FXSEL(SEL_COMMAND, MID_GNE_OPENPYTHONTOOLDIALOG), nullptr);
61
}
62
63
64
long
65
GNERunPythonToolDialog::onCmdAccept(FXObject*, FXSelector, void*) {
66
// close run dialog and call postprocessing
67
closeDialogCanceling();
68
// reset text
69
myText->setText("", 0);
70
// call postprocessing dialog
71
if (myError) {
72
return 1;
73
} else {
74
// execute post processing
75
return myApplicationWindow->handle(myPythonTool->getMenuCommand(), FXSEL(SEL_COMMAND, MID_GNE_POSTPROCESSINGPYTHONTOOL), nullptr);
76
}
77
}
78
79
/****************************************************************************/
80
81