Book a Demo!
CoCalc Logo Icon
StoreFeaturesDocsShareSupportNewsAboutPoliciesSign UpSign In
eclipse
GitHub Repository: eclipse/sumo
Path: blob/main/tools/neteditTestFunctions/frames/network/tls.py
169686 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 tls.py
15
# @author Pablo Alvarez Lopez
16
# @date 28-05-25
17
18
# imports
19
import time
20
from ...enums.attributesEnum import attrs
21
from ...constants import DELAY_SELECT
22
from ...general.functions import focusOnFrame, typeKey
23
24
25
def createTLS():
26
"""
27
@brief Create TLS in the current selected Junction
28
"""
29
# focus current frame
30
focusOnFrame()
31
# type tab 2 times to jump to create TLS button
32
for _ in range(attrs.TLS.create):
33
typeKey('tab')
34
# create TLS
35
typeKey('space')
36
# wait
37
time.sleep(DELAY_SELECT)
38
39
40
def createTLSOverlapped():
41
"""
42
@brief Create TLS in overlapped junction
43
"""
44
# focus current frame
45
focusOnFrame()
46
# type tab 2 times to jump to create TLS button
47
for _ in range(attrs.TLS.createOverlapped):
48
typeKey('tab')
49
# press space
50
typeKey('space')
51
for _ in range(attrs.TLS.createOverlapped):
52
typeKey('tab')
53
# create TLS
54
typeKey('space')
55
56
57
def copyTLS(joined):
58
"""
59
@brief copy TLS in the current selected Junction
60
"""
61
# focus current frame
62
focusOnFrame()
63
# type tab 2 times to jump to create TLS button
64
if (joined):
65
for _ in range(attrs.TLS.copyJoined):
66
typeKey('tab')
67
else:
68
for _ in range(attrs.TLS.copySingle):
69
typeKey('tab')
70
# create TLS
71
typeKey('space')
72
73
74
def joinTSL():
75
"""
76
@brief join TLS
77
"""
78
# focus current frame
79
focusOnFrame()
80
# type tab 2 times to jump to create TLS button
81
for _ in range(attrs.TLS.joinTLS):
82
typeKey('tab')
83
# create TLS
84
typeKey('space')
85
86
87
def disJoinTLS():
88
"""
89
@brief disjoin the current TLS
90
"""
91
# focus current frame
92
focusOnFrame()
93
# type tab 2 times to jump to create TLS button
94
for _ in range(attrs.TLS.disjoinTLS):
95
typeKey('tab')
96
# create TLS
97
typeKey('space')
98
99
100
def deleteTLS(joined):
101
"""
102
@brief copy TLS in the current selected Junction
103
"""
104
# focus current frame
105
focusOnFrame()
106
# type tab 2 times to jump to delete TLS button
107
if (joined):
108
for _ in range(attrs.TLS.deleteJoined):
109
typeKey('tab')
110
else:
111
for _ in range(attrs.TLS.deleteSingle):
112
typeKey('tab')
113
# create TLS
114
typeKey('space')
115
116
117
def resetSingleTLSPhases(joined):
118
"""
119
@brief copy TLS in the current selected Junction
120
"""
121
# focus current frame
122
focusOnFrame()
123
# type tab 2 times to jump to create TLS button
124
if (joined):
125
for _ in range(attrs.TLS.resetPhaseSingle):
126
typeKey('tab')
127
else:
128
for _ in range(attrs.TLS.resetPhaseJoined):
129
typeKey('tab')
130
# create TLS
131
typeKey('space')
132
133
134
def resetAllTLSPhases(joined):
135
"""
136
@brief copy TLS in the current selected Junction
137
"""
138
# focus current frame
139
focusOnFrame()
140
# type tab 2 times to jump to create TLS button
141
if (joined):
142
for _ in range(attrs.TLS.resetAllJoined):
143
typeKey('tab')
144
else:
145
for _ in range(attrs.TLS.resetAllSingle):
146
typeKey('tab')
147
# create TLS
148
typeKey('space')
149
150