Files
maps-saas/fix_controller.py
T

27 lines
773 B
Python

import re
path = "packages/tactical_app/lib/controllers/tactical_map_controller.dart"
with open(path, "r") as f:
content = f.read()
# Remove the incorrectly inserted lines
content = content.replace(" // Expand sheet back after picking\n if (activeSheet.value != null) {\n isSheetMinimized.value = false;\n }", "")
# Correctly insert at the end of confirmPicker
insert_target = """ case MapPickerTarget.routeDestination:
pickedRouteDestination.value = pos;
switchMode('routing');
break;
}
"""
replacement = insert_target + """
if (activeSheet.value != null) {
isSheetMinimized.value = false;
}
"""
content = content.replace(insert_target, replacement)
with open(path, "w") as f:
f.write(content)