Book a Demo!
CoCalc Logo Icon
StoreFeaturesDocsShareSupportNewsAboutPoliciesSign UpSign In
eclipse
GitHub Repository: eclipse/sumo
Path: blob/main/tools/neteditTestFunctions/frames/elements.py
169678 views
1
# -*- coding: utf-8 -*-
2
# Eclipse SUMO, Simulation of Urban MObility; see https://eclipse.dev/sumo
3
# Copyright (C) 2009-2025 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 changeParentElement(frame, element):
68
"""
69
@brief change parent element in the given frame (stop...)
70
"""
71
# focus current frame
72
focusOnFrame()
73
# go to first editable element of frame
74
if (frame == "routeFrame"):
75
for _ in range(attrs.frames.changeParentElement.route):
76
typeKey('tab')
77
elif (frame == "stopFrame"):
78
for _ in range(attrs.frames.changeParentElement.stop):
79
typeKey('tab')
80
# paste the new value
81
updateText(element)
82
# type enter to save change
83
typeKey('enter')
84
85
86
def changePlan(type, plan, flow):
87
"""
88
@brief change plan (in person or container frame)
89
"""
90
# focus current frame
91
focusOnFrame()
92
# continue depending of type
93
if (type == "person"):
94
# jump to person plan
95
if (flow):
96
for _ in range(attrs.frames.changePlan.personFlow):
97
typeKey('tab')
98
else:
99
for _ in range(attrs.frames.changePlan.person):
100
typeKey('tab')
101
elif (type == "container"):
102
# jump to container plan
103
if (flow):
104
for _ in range(attrs.frames.changePlan.containerFlow):
105
typeKey('tab')
106
else:
107
for _ in range(attrs.frames.changePlan.container):
108
typeKey('tab')
109
# paste the new plan
110
updateText(plan)
111
# type enter to save change
112
typeKey('enter')
113
114