Path: blob/main/tools/neteditTestFunctions/general/modes.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 modes.py14# @author Pablo Alvarez Lopez15# @date 28-05-251617# imports18import time19from ..constants import DELAY_RECOMPUTE20from ..input.keyboard import typeKey, typeTwoKeys212223def changeSupermode(supermode):24"""25@brief change supermode26"""27match supermode:28# common modes29case "network":30typeKey('F2')31case "demand":32typeKey('F3')33case "data":34typeKey('F4')35case _:36raise Exception("Invalid supermode")37# wait for recompute38time.sleep(DELAY_RECOMPUTE)394041def changeMode(mode):42"""43@brief change edit mode44"""45match mode:46# common modes47case "inspect":48typeKey('i')49case "delete":50typeKey('d')51case "select":52typeKey('s')53# network modes54case "createEdge":55typeKey('e')56case "move":57typeKey('m')58case "crossing":59typeKey('r')60case "connection":61typeKey('c')62case "additional":63typeKey('a')64case "shape":65typeKey('p')66case "TLS":67typeKey('t')68case "TAZ":69typeKey('z')70# demand modes71case "route":72typeKey('r')73case "vehicle":74typeKey('v')75case "type":76typeKey('t')77case "person":78typeKey('p')79case "personPlan":80typeKey('l')81case "container":82typeKey('c')83case "containerPlan":84typeKey('h')85case "stop":86typeKey('a')87# data modes88case "edgeData":89typeKey('e')90case "edgeRelData":91typeKey('r')92case "TAZRelData":93typeKey('z')94case "meanData":95typeKey('m')96case _:97raise Exception("Invalid mode")98# wait 1 second99time.sleep(1)100101102def changeEditMode(key):103"""104@brief Change edit mode (alt+1-9)105"""106typeTwoKeys('alt', key)107108109