Path: blob/main/tools/neteditTestFunctions/frames/edit/files.py
169686 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 files.py14# @author Pablo Alvarez Lopez15# @date 28-05-251617# imports18import time1920from ...constants import TEXTTEST_SANDBOX21from ...enums.attributesEnum import attrs22from ...general.functions import focusOnFrame23from ...frames.edit.basicAttribute import modifyAttribute, modifyAttributeOverlapped24from ...input.keyboard import typeKey, typeTwoKeys, updateText252627def modifyFile(type: str, attributeIndex):28"""29@brief modify additional file30"""31if (type == "additional"):32file = "additionals2.add.xml"33elif (type == "demand"):34file = "routes2.rou.xml"35modifyAttribute(attributeIndex, TEXTTEST_SANDBOX + "/" + file)363738def modifyFileOverlapped(type: str, attributeIndex):39"""40@brief modify additional file overlapped41"""42if (type == "additional"):43file = "additionals2.add.xml"44elif (type == "demand"):45file = "routes2.rou.xml"46modifyAttributeOverlapped(attributeIndex, TEXTTEST_SANDBOX + "/" + file)474849def modifyFileDialog(type: str, attributeIndex, waitTime=2):50"""51@brief modify default file using dialog52"""53if (type == "additional"):54file = "additionals2.add.xml"55elif (type == "demand"):56file = "routes2.rou.xml"57# focus current frame58focusOnFrame()59# jump to attribute60for _ in range(attributeIndex):61typeKey('tab')62# Change current value63typeKey('space')64# wait for saving65time.sleep(waitTime)66# jump to filename TextField67typeTwoKeys('alt', 'f')68updateText(TEXTTEST_SANDBOX)69typeKey('enter')70updateText(file)71typeKey('enter')727374def modifyFileDialogOverlapped(type: str, attributeIndex, waitTime=2):75"""76@brief modify default additional file using dialog77"""78if (type == "additional"):79file = "additionals2.add.xml"80elif (type == "demand"):81file = "routes2.rou.xml"82# focus current frame83focusOnFrame()84# jump to attribute85for _ in range(attributeIndex + attrs.editElements.overlapped):86typeKey('tab')87# Change current value88typeKey('space')89# wait for saving90time.sleep(waitTime)91# jump to filename TextField92typeTwoKeys('alt', 'f')93updateText(TEXTTEST_SANDBOX)94typeKey('enter')95updateText(file)96typeKey('enter')979899