Files
Kifi/scratch/patch_title.py

40 lines
1.1 KiB
Python

import re
with open('kifi-app/lib/features/dashboard/presentation/dashboard_screen.dart', 'r') as f:
content = f.read()
replacement = """
String title = '';
int logicalIndex = _currentIndex;
if (_currentIndex == 0) {
title = 'Dashboard';
} else {
if (isProjectMode) {
if (logicalIndex == 1) title = 'Projects';
logicalIndex--;
}
if (title.isEmpty) {
if (isBusinessMode) {
if (logicalIndex == 1) title = 'Business Hub';
else if (logicalIndex == 2) title = 'Statistics';
else if (logicalIndex == 3) title = 'My Accounts';
else title = 'Budgets';
} else {
if (logicalIndex == 1) title = 'Statistics';
else if (logicalIndex == 2) title = 'My Accounts';
else title = 'Budgets';
}
}
}
"""
content = re.sub(
r'String title;\n int logicalIndex = _currentIndex;.*?else title = \'Budgets\';\n }\n }\n }',
replacement.strip(),
content,
flags=re.DOTALL
)
with open('kifi-app/lib/features/dashboard/presentation/dashboard_screen.dart', 'w') as f:
f.write(content)