Book a Demo!
CoCalc Logo Icon
StoreFeaturesDocsShareSupportNewsAboutPoliciesSign UpSign In
eclipse
GitHub Repository: eclipse/sumo
Path: blob/main/tools/neteditTestFunctions/frames/elements.py
193889 views
1
# -*- coding: utf-8 -*-
2
# Eclipse SUMO, Simulation of Urban MObility; see https://eclipse.dev/sumo
3
# Copyright (C) 2009-2026 German Aerospace Center (DLR) and others.
4
# This program and the accompanying materials are made available under the
5
# terms of the Eclipse Public License 2.0 which is available at
6
# https://www.eclipse.org/legal/epl-2.0/
7
# This Source Code may also be made available under the following Secondary
8
# Licenses when the conditions for such availability set forth in the Eclipse
9
# Public License 2.0 are satisfied: GNU General Public License, version 2
10
# or later which is available at
11
# https://www.gnu.org/licenses/old-licenses/gpl-2.0-standalone.html
12
# SPDX-License-Identifier: EPL-2.0 OR GPL-2.0-or-later
13
14
# @file elements.py
15
# @author Pablo Alvarez Lopez
16
# @date 28-05-25
17
18
# imports
19
from ..enums.attributesEnum import attrs
20
from ..general.functions import focusOnFrame
21
from ..input.keyboard import typeKey, updateText
22
23
24
def changeElement(frame, element):
25
"""
26
@brief change element in the given frame (Additional, shape, vehicle...)
27
"""
28
# focus current frame
29
focusOnFrame()
30
# go to first editable element of frame
31
if (frame == "additionalFrame"):
32
for _ in range(attrs.frames.changeElement.additional):
33
typeKey('tab')
34
elif (frame == "shapeFrame"):
35
for _ in range(attrs.frames.changeElement.shape):
36
typeKey('tab')
37
elif (frame == "vehicleFrame"):
38
for _ in range(attrs.frames.changeElement.vehicle):
39
typeKey('tab')
40
elif (frame == "routeFrame"):
41
for _ in range(attrs.frames.changeElement.route):
42
typeKey('tab')
43
elif (frame == "personFrame"):
44
for _ in range(attrs.frames.changeElement.person):
45
typeKey('tab')
46
elif (frame == "containerFrame"):
47
for _ in range(attrs.frames.changeElement.container):
48
typeKey('tab')
49
elif (frame == "personPlanFrame"):
50
for _ in range(attrs.frames.changeElement.personPlan):
51
typeKey('tab')
52
elif (frame == "containerPlanFrame"):
53
for _ in range(attrs.frames.changeElement.containerPlan):
54
typeKey('tab')
55
elif (frame == "stopFrameFrame"):
56
for _ in range(attrs.frames.changeElement.stop):
57
typeKey('tab')
58
elif (frame == "meanDataFrame"):
59
for _ in range(attrs.frames.changeElement.meanData):
60
typeKey('tab')
61
# paste the new value
62
updateText(element)
63
# type enter to save change
64
typeKey('enter')
65
66
67
def changePlan(type, plan, flow):
68
"""
69
@brief change plan (in person or container frame)
70
"""
71
# focus current frame
72
focusOnFrame()
73
# continue depending of type
74
if (type == "person"):
75
# jump to person plan
76
if (flow):
77
for _ in range(attrs.frames.changePlan.personFlow):
78
typeKey('tab')
79
else:
80
for _ in range(attrs.frames.changePlan.person):
81
typeKey('tab')
82
elif (type == "container"):
83
# jump to container plan
84
if (flow):
85
for _ in range(attrs.frames.changePlan.containerFlow):
86
typeKey('tab')
87
else:
88
for _ in range(attrs.frames.changePlan.container):
89
typeKey('tab')
90
# paste the new plan
91
updateText(plan)
92
# type enter to save change
93
typeKey('enter')
94
95