-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathadjust_spacing_final.py
More file actions
75 lines (63 loc) · 2.13 KB
/
Copy pathadjust_spacing_final.py
File metadata and controls
75 lines (63 loc) · 2.13 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
#!/usr/bin/env python3
"""
Ajuste final de espaçamento:
- Reduz pady inferior do center para 5 (antes era 38 ou 15)
- Reduz altura mínima da janela para 500 (antes 550)
- Faz backup automático da pasta core
"""
import shutil
import re
import sys
from pathlib import Path
from datetime import datetime
CORE_DIR = Path("core")
MAIN_FILE = CORE_DIR / "main.py"
BACKUP_DIR = Path("backups")
def fazer_backup():
"""Cria um backup da pasta core com timestamp"""
BACKUP_DIR.mkdir(exist_ok=True)
timestamp = datetime.now().strftime("%Y%m%d_%H%M%S")
backup_path = BACKUP_DIR / f"core_{timestamp}"
if CORE_DIR.exists():
shutil.copytree(CORE_DIR, backup_path)
print(f"✅ Backup criado em: {backup_path}")
return True
else:
print("❌ Pasta core não encontrada!")
return False
def main():
print("🔧 Aplicando ajuste final de espaçamento...")
# Backup
if not fazer_backup():
sys.exit(1)
if not MAIN_FILE.exists():
print("❌ Arquivo core/main.py não encontrado!")
sys.exit(1)
with open(MAIN_FILE, "r", encoding="utf-8") as f:
content = f.read()
# 1. Alterar pady do center para (38, 5)
novo_conteudo = re.sub(
r'(center\.pack\(expand=False, fill="x", pady=)\(38,\s*\d+\)',
r'\g<1>(38, 5)',
content
)
# 2. Alterar minsize para 900x500
novo_conteudo = re.sub(
r'self\.minsize\(900,\s*\d+\)',
'self.minsize(900, 500)',
novo_conteudo
)
if novo_conteudo == content:
print("⚠️ Nenhuma alteração foi feita. Verifique se as linhas existem:")
print(' - center.pack(expand=False, fill="x", pady=(38, ...))')
print(' - self.minsize(900, 550)')
else:
with open(MAIN_FILE, "w", encoding="utf-8") as f:
f.write(novo_conteudo)
print("✅ Ajustes aplicados:")
print(" - pady inferior do center = 5")
print(" - altura mínima da janela = 500")
print("▶️ Execute 'python -m core.main' para testar.")
print("🧹 Após testar, pode excluir este script.")
if __name__ == "__main__":
main()