Files
manual_slop/debug_tasks.py

29 lines
996 B
Python

with open("src/app_controller.py", "r", encoding="utf-8", newline="") as f:
content = f.read()
# Add debug to _process_pending_gui_tasks to see what's happening
old = """def _process_pending_gui_tasks(self) -> None:
if not self._pending_gui_tasks:
return
with self._pending_gui_tasks_lock:
tasks = self._pending_gui_tasks[:]
self._pending_gui_tasks.clear()"""
new = """def _process_pending_gui_tasks(self) -> None:
if not self._pending_gui_tasks:
return
with self._pending_gui_tasks_lock:
tasks = self._pending_gui_tasks[:]
sys.stderr.write(f"[DEBUG] _process_pending_gui_tasks: processing {len(tasks)} tasks\\n")
for t in tasks:
sys.stderr.write(f"[DEBUG] task action: {t.get('action')}\\n")
sys.stderr.flush()
self._pending_gui_tasks.clear()"""
content = content.replace(old, new)
with open("src/app_controller.py", "w", encoding="utf-8", newline="") as f:
f.write(content)
print("Added debug to _process_pending_gui_tasks")