Skip to content
GitLab
Projects
Groups
Snippets
/
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Sign in
Toggle navigation
Menu
Open sidebar
Mayer
CircularGreenSimCity
Commits
4a031c3e
Commit
4a031c3e
authored
Apr 05, 2024
by
Eric Duminil
Browse files
FIXME
parent
f9bcbc05
Changes
1
Show whitespace changes
Inline
Side-by-side
python_scripts/run_simstadt_from_python/variable_window_ratio.py
View file @
4a031c3e
...
@@ -46,20 +46,20 @@ lib_node.text = str(custom_library_path)
...
@@ -46,20 +46,20 @@ lib_node.text = str(custom_library_path)
tree
.
write
(
physics_processor_params
)
tree
.
write
(
physics_processor_params
)
##########################################################
##########################################################
with
open
(
custom_library_path
)
as
library_file
:
content
=
library_file
.
read
()
for
window_ratio
in
WINDOW_RATIOS
:
for
window_ratio
in
WINDOW_RATIOS
:
#################### Update lib with custom values ############################
#################### Update lib with custom values ############################
with
open
(
custom_library_path
)
as
library_file
:
content
=
library_file
.
read
()
new_content
=
re
.
sub
(
r
"<name>[\w ]+</name>"
,
new_content
=
re
.
sub
(
r
"<name>[\w ]+</name>"
,
f
"<name>Custom Physics Library with Window Ratio :
{
window_ratio
}
</name>"
,
f
"<name>Custom Physics Library with Window Ratio :
{
window_ratio
}
</name>"
,
content
,
content
,
1
)
1
)
# FIXME: Use et.parse instead. Because groundSurfaces shouldn't have any WindowRatio
new_content
=
re
.
sub
(
r
"<windowRatio>[\d\.]+</windowRatio>"
,
new_content
=
re
.
sub
(
r
"<windowRatio>[\d\.]+</windowRatio>"
,
f
"<windowRatio>
{
window_ratio
}
</windowRatio>"
,
f
"<windowRatio>
{
window_ratio
}
</windowRatio>"
,
content
)
new_
content
)
with
open
(
custom_library_path
,
'w'
)
as
library_file
:
with
open
(
custom_library_path
,
'w'
)
as
library_file
:
library_file
.
write
(
new_content
)
library_file
.
write
(
new_content
)
...
...
Write
Preview
Supports
Markdown
0%
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment