Path: blob/main/tools/neteditTestFunctions/frames/network/connection.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 connection.py14# @author Pablo Alvarez Lopez15# @date 28-05-251617# imports18import time1920from ...enums.attributesEnum import attrs21from ...constants import DELAY_SELECT22from ...general.functions import focusOnFrame23from ...input.mouse import leftClick24from ...input.keyboard import typeKey, keyPress, keyRelease252627def createConnection(referencePosition, fromLanePosition, toLanePosition):28"""29@brief create connection30"""31# select first lane32leftClick(referencePosition, fromLanePosition)33# select another lane for create a connection34leftClick(referencePosition, toLanePosition)353637def createConnectionConflict(referencePosition, fromLanePosition, toLanePosition):38"""39@brief create connection conflict40"""41# press control42keyPress('ctrl')43# select first lane44leftClick(referencePosition, fromLanePosition)45# select another lane for create a connection46leftClick(referencePosition, toLanePosition)47# release control48keyRelease('ctrl')495051def createConnectionYield(referencePosition, fromLanePosition, toLanePosition):52"""53@brief create connection54"""55# press shift56keyPress('shift')57# select first lane58leftClick(referencePosition, fromLanePosition)59# select another lane for create a connection60leftClick(referencePosition, toLanePosition)61# release shift62keyRelease('shift')636465def saveConnectionEdit():66"""67@brief Change to crossing mode68"""69# focus current frame70focusOnFrame()71# go to cancel button72for _ in range(attrs.connection.saveConnections):73typeKey('tab')74# type space to press button75typeKey('space')76# wait for gl debug77time.sleep(DELAY_SELECT)787980