Path: blob/main/src/netedit/dialogs/run/GNERunPythonToolDialog.cpp
169684 views
/****************************************************************************/1// Eclipse SUMO, Simulation of Urban MObility; see https://eclipse.dev/sumo2// Copyright (C) 2001-2025 German Aerospace Center (DLR) and others.3// This program and the accompanying materials are made available under the4// terms of the Eclipse Public License 2.0 which is available at5// https://www.eclipse.org/legal/epl-2.0/6// This Source Code may also be made available under the following Secondary7// Licenses when the conditions for such availability set forth in the Eclipse8// Public License 2.0 are satisfied: GNU General Public License, version 29// or later which is available at10// https://www.gnu.org/licenses/old-licenses/gpl-2.0-standalone.html11// SPDX-License-Identifier: EPL-2.0 OR GPL-2.0-or-later12/****************************************************************************/13/// @file GNERunPythonToolDialog.cpp14/// @author Pablo Alvarez Lopez15/// @date Mar 202316///17// Dialog for running tools18/****************************************************************************/1920#include <netedit/GNEApplicationWindow.h>21#include <netedit/GNEExternalRunner.h>22#include <netedit/tools/GNEPythonTool.h>2324#include "GNERunPythonToolDialog.h"2526// ============================================-===============================27// member method definitions28// ===========================================================================2930GNERunPythonToolDialog::GNERunPythonToolDialog(GNEApplicationWindow* applicationWindow, GNEPythonTool* pythonTool) :31GNERunDialog(applicationWindow, TL("Python Tool"), GUIIcon::TOOL_PYTHON),32myPythonTool(pythonTool) {33// run tool34applicationWindow->getExternalRunner()->runTool(this);35// open modal dialog36openDialog();37}383940GNERunPythonToolDialog::~GNERunPythonToolDialog() {}414243void44GNERunPythonToolDialog::runInternalTest(const InternalTestStep::DialogArgument* /*dialogTest*/) {45// finish46}474849std::string50GNERunPythonToolDialog::getRunCommand() const {51return myPythonTool->getCommand();52}535455long56GNERunPythonToolDialog::onCmdBack(FXObject*, FXSelector, void*) {57// close runTool dialog and open tool dialog58onCmdClose(nullptr, 0, nullptr);59return myApplicationWindow->handle(myPythonTool->getMenuCommand(), FXSEL(SEL_COMMAND, MID_GNE_OPENPYTHONTOOLDIALOG), nullptr);60}616263long64GNERunPythonToolDialog::onCmdAccept(FXObject*, FXSelector, void*) {65// close run dialog and call postprocessing66closeDialogCanceling();67// reset text68myText->setText("", 0);69// call postprocessing dialog70if (myError) {71return 1;72} else {73// execute post processing74return myApplicationWindow->handle(myPythonTool->getMenuCommand(), FXSEL(SEL_COMMAND, MID_GNE_POSTPROCESSINGPYTHONTOOL), nullptr);75}76}7778/****************************************************************************/798081