Watch
1
0
Fork
You've already forked Seyyed_arc
0
forked from hesabix/arc
Seyyed_arc/hesabixUI/hesabix_ui/tool_expand_after_pdf.py
2026-04-25 02:31:13 +03:30

36 lines
1.1 KiB
Python
Executable file

"""Add expand before closing ); when config has pdfEndpoint after defaultSortDesc (top suppliers/customers style)."""
from __future__ import annotations
import re
from pathlib import Path
ROOT = Path(__file__).resolve().parent / "lib" / "pages"
PAT = re.compile(
r"( defaultSortDesc: (?:true|false),\n excelEndpoint:[^\n]+\n pdfEndpoint:[^\n]+\n)( \);\n \}\n\n @override\n Widget build\(BuildContext context\) \{)",
re.MULTILINE,
)
def main() -> None:
for path in sorted(ROOT.rglob("*.dart")):
raw = path.read_text(encoding="utf-8")
if "expandBodyHeightToFitRows" in raw:
continue
if "DataTableWidget" not in raw:
continue
m = PAT.search(raw)
if not m:
continue
new_raw = PAT.sub(
r"\1 expandBodyHeightToFitRows: true,\n\2",
raw,
count=1,
)
if new_raw != raw:
path.write_text(new_raw, encoding="utf-8")
print(path.relative_to(ROOT.parent))
if __name__ == "__main__":
main()