INNER CODE UNIT · Python
_on_screenshot_hotkey
alex-jb/orallexa-ai-trading-agent · desktop_agent/main.py:142
def _on_screenshot_hotkey() -> None:
bull._win.after(0, _run_screenshot_analysis)
def _run_screenshot_analysis() -> None:
# Phase 1: Prevent concurrent analysis
if not _analysis_lock.acquire(blocking=False):
bull.flash_state("warning", t("already_analyzing"), 2000)
return
# Phase 2: Instant feedback — flash listening before thinking
bull.set_state("listening", t("capturing"))
bull._win.after(200, lambda: bull.set_state("thinking", t("analyzing_chart")))
def _do_analysis():
try:
from desktop_agent.screenshot import capture_screen
img_bytes = capture_screen()
if img_bytes is None: