Eclipse SUMO - Simulation of Urban MObility
Loading...
Searching...
No Matches
run/GNERunPythonToolDialog.cpp
Go to the documentation of this file.
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/****************************************************************************/
18// Dialog for running tools
19/****************************************************************************/
20
24
26
27// ============================================-===============================
28// member method definitions
29// ===========================================================================
30
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
42
43
44void
48
49
50std::string
54
55
56long
57GNERunPythonToolDialog::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
64long
65GNERunPythonToolDialog::onCmdAccept(FXObject*, FXSelector, void*) {
66 // close run dialog and call postprocessing
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/****************************************************************************/
@ MID_GNE_OPENPYTHONTOOLDIALOG
call tool
Definition GUIAppEnum.h:757
@ MID_GNE_POSTPROCESSINGPYTHONTOOL
call tool for post processing
Definition GUIAppEnum.h:761
GUIIcon
An enumeration of icons used by the gui applications.
Definition GUIIcons.h:33
#define TL(string)
Definition MsgHandler.h:304
The main window of Netedit.
GNEExternalRunner * getExternalRunner() const
get external runner
GNEApplicationWindow * myApplicationWindow
FOX needs this.
Definition GNEDialog.h:143
void openDialog(FXWindow *focusableElement=nullptr)
open dialog
long closeDialogCanceling()
close dialog declining the changes
void runTool(GNERunDialog *runDialog)
run tool called from dialog
virtual std::string getCommand() const
get command (python + script + arguments)
FXMenuCommand * getMenuCommand() const
get menu command
bool myError
flag to check if there is an error
void runInternalTest(const InternalTestStep::DialogArgument *dialogArgument)
run internal test
std::string getRunCommand() const
get run command
long onCmdBack(FXObject *, FXSelector, void *)
event after press back button
GNERunPythonToolDialog(GNEApplicationWindow *applicationWindow, GNEPythonTool *pythonTool)
Constructor.
const GNEPythonTool * myPythonTool
python tool to run
long onCmdAccept(FXObject *, FXSelector, void *)
event after press close button
dialog arguments, used for certain modal dialogs that can not be edited using tab