Path: blob/main/tools/neteditTestFunctions/frames/elements.py
193889 views
# -*- coding: utf-8 -*-1# Eclipse SUMO, Simulation of Urban MObility; see https://eclipse.dev/sumo2# Copyright (C) 2009-2026 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-later1213# @file elements.py14# @author Pablo Alvarez Lopez15# @date 28-05-251617# imports18from ..enums.attributesEnum import attrs19from ..general.functions import focusOnFrame20from ..input.keyboard import typeKey, updateText212223def changeElement(frame, element):24"""25@brief change element in the given frame (Additional, shape, vehicle...)26"""27# focus current frame28focusOnFrame()29# go to first editable element of frame30if (frame == "additionalFrame"):31for _ in range(attrs.frames.changeElement.additional):32typeKey('tab')33elif (frame == "shapeFrame"):34for _ in range(attrs.frames.changeElement.shape):35typeKey('tab')36elif (frame == "vehicleFrame"):37for _ in range(attrs.frames.changeElement.vehicle):38typeKey('tab')39elif (frame == "routeFrame"):40for _ in range(attrs.frames.changeElement.route):41typeKey('tab')42elif (frame == "personFrame"):43for _ in range(attrs.frames.changeElement.person):44typeKey('tab')45elif (frame == "containerFrame"):46for _ in range(attrs.frames.changeElement.container):47typeKey('tab')48elif (frame == "personPlanFrame"):49for _ in range(attrs.frames.changeElement.personPlan):50typeKey('tab')51elif (frame == "containerPlanFrame"):52for _ in range(attrs.frames.changeElement.containerPlan):53typeKey('tab')54elif (frame == "stopFrameFrame"):55for _ in range(attrs.frames.changeElement.stop):56typeKey('tab')57elif (frame == "meanDataFrame"):58for _ in range(attrs.frames.changeElement.meanData):59typeKey('tab')60# paste the new value61updateText(element)62# type enter to save change63typeKey('enter')646566def changePlan(type, plan, flow):67"""68@brief change plan (in person or container frame)69"""70# focus current frame71focusOnFrame()72# continue depending of type73if (type == "person"):74# jump to person plan75if (flow):76for _ in range(attrs.frames.changePlan.personFlow):77typeKey('tab')78else:79for _ in range(attrs.frames.changePlan.person):80typeKey('tab')81elif (type == "container"):82# jump to container plan83if (flow):84for _ in range(attrs.frames.changePlan.containerFlow):85typeKey('tab')86else:87for _ in range(attrs.frames.changePlan.container):88typeKey('tab')89# paste the new plan90updateText(plan)91# type enter to save change92typeKey('enter')939495