mirror of
https://github.com/Pax1601/DCSOlympus.git
synced 2025-10-29 16:56:34 +00:00
Major refactor of the Python API: moved modules into subdirectories, replaced app.py with api.py, and added new audio and utility modules. Backend C++ code now tracks command execution results, exposes them via the API, and improves command result handling. Also includes updates to the SRS audio handler, random string generation, and VSCode launch configurations.
19 lines
493 B
Python
19 lines
493 B
Python
import re
|
|
|
|
# Read the file
|
|
with open('unit.py', 'r', encoding='utf-8') as f:
|
|
content = f.read()
|
|
|
|
# Pattern to match callback invocations
|
|
pattern = r'self\.on_property_change_callbacks\[\"(\w+)\"\]\(self, self\.(\w+)\)'
|
|
replacement = r'self._trigger_callback("\1", self.\2)'
|
|
|
|
# Replace all matches
|
|
new_content = re.sub(pattern, replacement, content)
|
|
|
|
# Write back to file
|
|
with open('unit.py', 'w', encoding='utf-8') as f:
|
|
f.write(new_content)
|
|
|
|
print('Updated all callback invocations')
|