Path: blob/main/tools/neteditTestFunctions/frames/network/tls.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 tls.py14# @author Pablo Alvarez Lopez15# @date 28-05-251617# imports18import time19from ...enums.attributesEnum import attrs20from ...constants import DELAY_SELECT21from ...general.functions import focusOnFrame, typeKey222324def createTLS():25"""26@brief Create TLS in the current selected Junction27"""28# focus current frame29focusOnFrame()30# type tab 2 times to jump to create TLS button31for _ in range(attrs.TLS.create):32typeKey('tab')33# create TLS34typeKey('space')35# wait36time.sleep(DELAY_SELECT)373839def createTLSOverlapped():40"""41@brief Create TLS in overlapped junction42"""43# focus current frame44focusOnFrame()45# type tab 2 times to jump to create TLS button46for _ in range(attrs.TLS.createOverlapped):47typeKey('tab')48# press space49typeKey('space')50for _ in range(attrs.TLS.createOverlapped):51typeKey('tab')52# create TLS53typeKey('space')545556def copyTLS(joined):57"""58@brief copy TLS in the current selected Junction59"""60# focus current frame61focusOnFrame()62# type tab 2 times to jump to create TLS button63if (joined):64for _ in range(attrs.TLS.copyJoined):65typeKey('tab')66else:67for _ in range(attrs.TLS.copySingle):68typeKey('tab')69# create TLS70typeKey('space')717273def joinTSL():74"""75@brief join TLS76"""77# focus current frame78focusOnFrame()79# type tab 2 times to jump to create TLS button80for _ in range(attrs.TLS.joinTLS):81typeKey('tab')82# create TLS83typeKey('space')848586def disJoinTLS():87"""88@brief disjoin the current TLS89"""90# focus current frame91focusOnFrame()92# type tab 2 times to jump to create TLS button93for _ in range(attrs.TLS.disjoinTLS):94typeKey('tab')95# create TLS96typeKey('space')979899def deleteTLS(joined):100"""101@brief copy TLS in the current selected Junction102"""103# focus current frame104focusOnFrame()105# type tab 2 times to jump to delete TLS button106if (joined):107for _ in range(attrs.TLS.deleteJoined):108typeKey('tab')109else:110for _ in range(attrs.TLS.deleteSingle):111typeKey('tab')112# create TLS113typeKey('space')114115116def resetSingleTLSPhases(joined):117"""118@brief copy TLS in the current selected Junction119"""120# focus current frame121focusOnFrame()122# type tab 2 times to jump to create TLS button123if (joined):124for _ in range(attrs.TLS.resetPhaseSingle):125typeKey('tab')126else:127for _ in range(attrs.TLS.resetPhaseJoined):128typeKey('tab')129# create TLS130typeKey('space')131132133def resetAllTLSPhases(joined):134"""135@brief copy TLS in the current selected Junction136"""137# focus current frame138focusOnFrame()139# type tab 2 times to jump to create TLS button140if (joined):141for _ in range(attrs.TLS.resetAllJoined):142typeKey('tab')143else:144for _ in range(attrs.TLS.resetAllSingle):145typeKey('tab')146# create TLS147typeKey('space')148149150