migrazione verso gitea
This commit is contained in:
13
fix_query.py
13
fix_query.py
@@ -1,3 +1,10 @@
|
||||
"""One-off maintenance script to patch performance issues in ``layout_window``.
|
||||
|
||||
The script was used during development to remove an expensive resize-triggered
|
||||
refresh and to inject some lifecycle guards into the window implementation.
|
||||
It is kept in the repository as an auditable patch recipe.
|
||||
"""
|
||||
|
||||
from pathlib import Path
|
||||
import re
|
||||
|
||||
@@ -6,6 +13,7 @@ src = p.read_text(encoding="utf-8")
|
||||
|
||||
backup = p.with_suffix(".py.bak_perf")
|
||||
if not backup.exists():
|
||||
# Preserve the original version so the patch can be reversed manually.
|
||||
backup.write_text(src, encoding="utf-8")
|
||||
|
||||
# 1) Rimuovi il bind su <Configure> che innescava refresh continui.
|
||||
@@ -60,8 +68,7 @@ if "def destroy(self):" not in src:
|
||||
)
|
||||
src = src[:insert_point] + destroy_method + src[insert_point:]
|
||||
|
||||
# 4) Nei callback _ok/_err delle query, assicurati che non facciano nulla se la finestra è chiusa
|
||||
# => sostituiamo 'def _ok(res):' con un guard iniziale e idem per _err.
|
||||
# 4) Nei callback _ok/_err delle query, assicurati che non facciano nulla se la finestra è chiusa.
|
||||
src = re.sub(
|
||||
r"def _ok\(res\):\n",
|
||||
"def _ok(res):\n"
|
||||
@@ -77,7 +84,7 @@ src = re.sub(
|
||||
src
|
||||
)
|
||||
|
||||
# 5) Piccola robustezza: prima di schedulare highlight post-ricarica controlla ancora _alive
|
||||
# 5) Piccola robustezza: prima di schedulare highlight post-ricarica controlla ancora _alive.
|
||||
src = src.replace(
|
||||
" if self._pending_focus and self._pending_focus[0] == corsia:\n",
|
||||
" if getattr(self, '_alive', True) and self._pending_focus and self._pending_focus[0] == corsia:\n"
|
||||
|
||||
Reference in New Issue
Block a user