Book a Demo!
CoCalc Logo Icon
StoreFeaturesDocsShareSupportNewsAboutPoliciesSign UpSign In
eclipse
GitHub Repository: eclipse/sumo
Path: blob/main/tools/neteditTestFunctions/frames/edit/vClassDialog.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 vClassDialog.py
15
# @author Pablo Alvarez Lopez
16
# @date 28-05-25
17
18
# imports
19
from ...enums.attributesEnum import attrs
20
from ...frames.edit.boolAttribute import modifyBoolAttribute, modifyBoolAttributeOverlapped
21
from ...input.keyboard import typeKey, typeTwoKeys
22
23
24
def modifyVClassDialog_NoDisallowAll(attribute, vClass):
25
"""
26
@brief modify vclass attribute using dialog
27
"""
28
# open dialog
29
modifyBoolAttribute(attribute)
30
# go to first button allow all vClasses
31
for _ in range(attrs.dialog.allowVClass.accept):
32
typeTwoKeys('shift', 'tab')
33
# go to vClass
34
for _ in range(vClass):
35
typeKey('tab')
36
# Change current value
37
typeKey('space')
38
# go to accept
39
for _ in range(attrs.dialog.allowVClass.accept - vClass):
40
typeKey('tab')
41
typeKey('space')
42
43
44
def modifyVClassDialogOverlapped_NoDisallowAll(attribute, vClass):
45
"""
46
@brief modify vclass attribute using dialog
47
"""
48
# open dialog
49
modifyBoolAttributeOverlapped(attribute)
50
# go to first button allow all vClasses
51
for _ in range(attrs.dialog.allowVClass.accept):
52
typeTwoKeys('shift', 'tab')
53
# go to vClass
54
for _ in range(vClass):
55
typeKey('tab')
56
# Change current value
57
typeKey('space')
58
# go to accept
59
for _ in range(attrs.dialog.allowVClass.accept - vClass):
60
typeKey('tab')
61
typeKey('space')
62
63
64
def modifyVClassDialog_DisallowAll(attribute, vClass):
65
"""
66
@brief modify vclass attribute using dialog (this disallow all other vClasses)
67
"""
68
# open dialog
69
modifyBoolAttribute(attribute)
70
# go to first button allow all vClasses
71
for _ in range(attrs.dialog.allowVClass.accept):
72
typeTwoKeys('shift', 'tab')
73
# disallow all
74
for _ in range(attrs.dialog.allowVClass.disallowAll):
75
typeKey('tab')
76
typeKey('space')
77
# go to vClass
78
for _ in range(vClass - attrs.dialog.allowVClass.disallowAll):
79
typeKey('tab')
80
# Change current value
81
typeKey('space')
82
# accept changes
83
for _ in range(attrs.dialog.allowVClass.accept - vClass):
84
typeKey('tab')
85
typeKey('space')
86
87
88
def modifyVClassDialogOverlapped_DisallowAll(attribute, vClass):
89
"""
90
@brief modify vclass attribute using dialog (this disallow all other vClasses)
91
"""
92
# open dialog
93
modifyBoolAttributeOverlapped(attribute)
94
# go to first button allow all vClasses
95
for _ in range(attrs.dialog.allowVClass.accept):
96
typeTwoKeys('shift', 'tab')
97
# disallow all
98
for _ in range(attrs.dialog.allowVClass.disallowAll):
99
typeKey('tab')
100
typeKey('space')
101
# go to vClass
102
for _ in range(vClass - attrs.dialog.allowVClass.disallowAll):
103
typeKey('tab')
104
# Change current value
105
typeKey('space')
106
# press accept
107
for _ in range(attrs.dialog.allowVClass.accept - vClass):
108
typeKey('tab')
109
typeKey('space')
110
111
112
def modifyVClassDialog_Cancel(attribute, vClass):
113
"""
114
@brief modify vclass attribute and cancel
115
"""
116
# open dialog
117
modifyBoolAttribute(attribute)
118
# go to first button allow all vClasses
119
for _ in range(attrs.dialog.allowVClass.accept):
120
typeTwoKeys('shift', 'tab')
121
# disallow all
122
for _ in range(attrs.dialog.allowVClass.disallowAll):
123
typeKey('tab')
124
typeKey('space')
125
# go to vClass
126
for _ in range(vClass - attrs.dialog.allowVClass.disallowAll):
127
typeKey('tab')
128
# Change current value
129
typeKey('space')
130
# cancel
131
for _ in range(attrs.dialog.allowVClass.cancel - vClass):
132
typeKey('tab')
133
typeKey('space')
134
135
136
def modifyVClassDialogOverlapped_Cancel(attribute, vClass):
137
"""
138
@brief modify vclass attribute and cancel (overlapped)
139
"""
140
# open dialog
141
modifyBoolAttributeOverlapped(attribute)
142
# go to first button allow all vClasses
143
for _ in range(attrs.dialog.allowVClass.accept):
144
typeTwoKeys('shift', 'tab')
145
# disallow all
146
for _ in range(attrs.dialog.allowVClass.disallowAll):
147
typeKey('tab')
148
typeKey('space')
149
# go to vClass
150
for _ in range(vClass - attrs.dialog.allowVClass.disallowAll):
151
typeKey('tab')
152
# Change current value
153
typeKey('space')
154
# cancel
155
for _ in range(attrs.dialog.allowVClass.cancel - vClass):
156
typeKey('tab')
157
typeKey('space')
158
159
160
def modifyVClassDialog_Reset(attribute, vClass):
161
"""
162
@brief modify vclass attribute and reset
163
"""
164
# open dialog
165
modifyBoolAttribute(attribute)
166
# go to first button allow all vClasses
167
for _ in range(attrs.dialog.allowVClass.accept):
168
typeTwoKeys('shift', 'tab')
169
# disallow all
170
for _ in range(attrs.dialog.allowVClass.disallowAll):
171
typeKey('tab')
172
typeKey('space')
173
# go to vClass
174
for _ in range(vClass - attrs.dialog.allowVClass.disallowAll):
175
typeKey('tab')
176
# Change current value
177
typeKey('space')
178
# reset
179
for _ in range(attrs.dialog.allowVClass.reset - vClass):
180
typeKey('tab')
181
typeKey('space')
182
for _ in range(2):
183
typeTwoKeys('shift', 'tab')
184
typeKey('space')
185
186
187
def modifyVClassDialogOverlapped_Reset(attribute, vClass):
188
"""
189
@brief modify vclass attribute and reset (overlapped)
190
"""
191
# open dialog
192
modifyBoolAttributeOverlapped(attribute)
193
# go to first button allow all vClasses
194
for _ in range(attrs.dialog.allowVClass.accept):
195
typeTwoKeys('shift', 'tab')
196
# disallow all
197
for _ in range(attrs.dialog.allowVClass.disallowAll):
198
typeKey('tab')
199
typeKey('space')
200
# go to vClass
201
for _ in range(vClass - attrs.dialog.allowVClass.disallowAll):
202
typeKey('tab')
203
# Change current value
204
typeKey('space')
205
# reset
206
for _ in range(attrs.dialog.allowVClass.reset - vClass):
207
typeKey('tab')
208
typeKey('space')
209
for _ in range(2):
210
typeTwoKeys('shift', 'tab')
211
typeKey('space')
212
213