Path: blob/main/tools/neteditTestFunctions/frames/elements.py
169678 views
# -*- coding: utf-8 -*-1# Eclipse SUMO, Simulation of Urban MObility; see https://eclipse.dev/sumo2# Copyright (C) 2009-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-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 changeParentElement(frame, element):67"""68@brief change parent element in the given frame (stop...)69"""70# focus current frame71focusOnFrame()72# go to first editable element of frame73if (frame == "routeFrame"):74for _ in range(attrs.frames.changeParentElement.route):75typeKey('tab')76elif (frame == "stopFrame"):77for _ in range(attrs.frames.changeParentElement.stop):78typeKey('tab')79# paste the new value80updateText(element)81# type enter to save change82typeKey('enter')838485def changePlan(type, plan, flow):86"""87@brief change plan (in person or container frame)88"""89# focus current frame90focusOnFrame()91# continue depending of type92if (type == "person"):93# jump to person plan94if (flow):95for _ in range(attrs.frames.changePlan.personFlow):96typeKey('tab')97else:98for _ in range(attrs.frames.changePlan.person):99typeKey('tab')100elif (type == "container"):101# jump to container plan102if (flow):103for _ in range(attrs.frames.changePlan.containerFlow):104typeKey('tab')105else:106for _ in range(attrs.frames.changePlan.container):107typeKey('tab')108# paste the new plan109updateText(plan)110# type enter to save change111typeKey('enter')112113114