1.2 KiB
1.2 KiB
gestione_aree_frame_async.py
Scopo
Questo modulo fornisce l'infrastruttura async usata dalle finestre GUI:
- loop asincrono globale;
- overlay di attesa;
- runner che collega coroutine e callback Tk.
Flusso infrastrutturale
flowchart TD
A["Metodo finestra GUI"] --> B["AsyncRunner.run(awaitable)"]
B --> C{"busy overlay richiesto?"}
C -- Si --> D["BusyOverlay.show()"]
C -- No --> E["Salta overlay"]
D --> F["run_coroutine_threadsafe(awaitable, loop globale)"]
E --> F
F --> G["Polling del Future"]
G --> H{"Future completato?"}
H -- No --> G
H -- Si --> I{"Successo o errore?"}
I -- Successo --> J["widget.after(..., on_success)"]
I -- Errore --> K["widget.after(..., on_error)"]
J --> L["BusyOverlay.hide()"]
K --> L
Schema di componenti
flowchart LR
Holder["_LoopHolder"] --> Loop["get_global_loop"]
Loop --> Runner["AsyncRunner"]
Overlay["BusyOverlay"] --> Runner
Runner --> GUI["Moduli GUI"]
Note
- Il modulo fa da ponte tra thread Tk e thread del loop asincrono.
BusyOverlaye riusato da piu finestre, quindi e un componente condiviso.AsyncRunnerevita che i moduli GUI gestiscano direttamente iFuture.