Path: blob/main/tools/neteditTestFunctions/frames/edit/vClassDialog.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 vClassDialog.py14# @author Pablo Alvarez Lopez15# @date 28-05-251617# imports18from ...enums.attributesEnum import attrs19from ...frames.edit.boolAttribute import modifyBoolAttribute, modifyBoolAttributeOverlapped20from ...input.keyboard import typeKey, typeTwoKeys212223def modifyVClassDialog_NoDisallowAll(attribute, vClass):24"""25@brief modify vclass attribute using dialog26"""27# open dialog28modifyBoolAttribute(attribute)29# go to first button allow all vClasses30for _ in range(attrs.dialog.allowVClass.accept):31typeTwoKeys('shift', 'tab')32# go to vClass33for _ in range(vClass):34typeKey('tab')35# Change current value36typeKey('space')37# go to accept38for _ in range(attrs.dialog.allowVClass.accept - vClass):39typeKey('tab')40typeKey('space')414243def modifyVClassDialogOverlapped_NoDisallowAll(attribute, vClass):44"""45@brief modify vclass attribute using dialog46"""47# open dialog48modifyBoolAttributeOverlapped(attribute)49# go to first button allow all vClasses50for _ in range(attrs.dialog.allowVClass.accept):51typeTwoKeys('shift', 'tab')52# go to vClass53for _ in range(vClass):54typeKey('tab')55# Change current value56typeKey('space')57# go to accept58for _ in range(attrs.dialog.allowVClass.accept - vClass):59typeKey('tab')60typeKey('space')616263def modifyVClassDialog_DisallowAll(attribute, vClass):64"""65@brief modify vclass attribute using dialog (this disallow all other vClasses)66"""67# open dialog68modifyBoolAttribute(attribute)69# go to first button allow all vClasses70for _ in range(attrs.dialog.allowVClass.accept):71typeTwoKeys('shift', 'tab')72# disallow all73for _ in range(attrs.dialog.allowVClass.disallowAll):74typeKey('tab')75typeKey('space')76# go to vClass77for _ in range(vClass - attrs.dialog.allowVClass.disallowAll):78typeKey('tab')79# Change current value80typeKey('space')81# accept changes82for _ in range(attrs.dialog.allowVClass.accept - vClass):83typeKey('tab')84typeKey('space')858687def modifyVClassDialogOverlapped_DisallowAll(attribute, vClass):88"""89@brief modify vclass attribute using dialog (this disallow all other vClasses)90"""91# open dialog92modifyBoolAttributeOverlapped(attribute)93# go to first button allow all vClasses94for _ in range(attrs.dialog.allowVClass.accept):95typeTwoKeys('shift', 'tab')96# disallow all97for _ in range(attrs.dialog.allowVClass.disallowAll):98typeKey('tab')99typeKey('space')100# go to vClass101for _ in range(vClass - attrs.dialog.allowVClass.disallowAll):102typeKey('tab')103# Change current value104typeKey('space')105# press accept106for _ in range(attrs.dialog.allowVClass.accept - vClass):107typeKey('tab')108typeKey('space')109110111def modifyVClassDialog_Cancel(attribute, vClass):112"""113@brief modify vclass attribute and cancel114"""115# open dialog116modifyBoolAttribute(attribute)117# go to first button allow all vClasses118for _ in range(attrs.dialog.allowVClass.accept):119typeTwoKeys('shift', 'tab')120# disallow all121for _ in range(attrs.dialog.allowVClass.disallowAll):122typeKey('tab')123typeKey('space')124# go to vClass125for _ in range(vClass - attrs.dialog.allowVClass.disallowAll):126typeKey('tab')127# Change current value128typeKey('space')129# cancel130for _ in range(attrs.dialog.allowVClass.cancel - vClass):131typeKey('tab')132typeKey('space')133134135def modifyVClassDialogOverlapped_Cancel(attribute, vClass):136"""137@brief modify vclass attribute and cancel (overlapped)138"""139# open dialog140modifyBoolAttributeOverlapped(attribute)141# go to first button allow all vClasses142for _ in range(attrs.dialog.allowVClass.accept):143typeTwoKeys('shift', 'tab')144# disallow all145for _ in range(attrs.dialog.allowVClass.disallowAll):146typeKey('tab')147typeKey('space')148# go to vClass149for _ in range(vClass - attrs.dialog.allowVClass.disallowAll):150typeKey('tab')151# Change current value152typeKey('space')153# cancel154for _ in range(attrs.dialog.allowVClass.cancel - vClass):155typeKey('tab')156typeKey('space')157158159def modifyVClassDialog_Reset(attribute, vClass):160"""161@brief modify vclass attribute and reset162"""163# open dialog164modifyBoolAttribute(attribute)165# go to first button allow all vClasses166for _ in range(attrs.dialog.allowVClass.accept):167typeTwoKeys('shift', 'tab')168# disallow all169for _ in range(attrs.dialog.allowVClass.disallowAll):170typeKey('tab')171typeKey('space')172# go to vClass173for _ in range(vClass - attrs.dialog.allowVClass.disallowAll):174typeKey('tab')175# Change current value176typeKey('space')177# reset178for _ in range(attrs.dialog.allowVClass.reset - vClass):179typeKey('tab')180typeKey('space')181for _ in range(2):182typeTwoKeys('shift', 'tab')183typeKey('space')184185186def modifyVClassDialogOverlapped_Reset(attribute, vClass):187"""188@brief modify vclass attribute and reset (overlapped)189"""190# open dialog191modifyBoolAttributeOverlapped(attribute)192# go to first button allow all vClasses193for _ in range(attrs.dialog.allowVClass.accept):194typeTwoKeys('shift', 'tab')195# disallow all196for _ in range(attrs.dialog.allowVClass.disallowAll):197typeKey('tab')198typeKey('space')199# go to vClass200for _ in range(vClass - attrs.dialog.allowVClass.disallowAll):201typeKey('tab')202# Change current value203typeKey('space')204# reset205for _ in range(attrs.dialog.allowVClass.reset - vClass):206typeKey('tab')207typeKey('space')208for _ in range(2):209typeTwoKeys('shift', 'tab')210typeKey('space')211212213