I really don’t like this!
If I need a process to be running “atomically” and don’t care about a frozen UI, I should be able to do it.
If I want to keep the UI responsive or I want to prevent the message from the browser about something taking to long, then I can explicitly call time.sleep(0)
or use a timer to split the process in discrete chunks.
Pulling the rug from under my feet can have unexpected dangerous side effects.
Right, but it would have an effect if amount_to_transfer
was a function that contains blocking code.
Disabling many components is very annoying, and often impossible. Think of a repeating panel or an alert or a custom component containing nested components, or a combination of all the above. How would you cycle through all the components and disable them?
That’s why I was suggesting a white list rather than a black list. It’s easier to say “please discard all the events with the exception of the cancel button, a timer and that other component” than saying “please discard this event” to every single event in every single component.
I’m afraid that, while the latter could be done by adding a simple decorator(*) to every event handler (which is only possible on simple forms), the former would need some low level intervention on the event loop.
(*) I assume that’s what your event_safe
decorator does, I’m on my cell now, I’ll check it tomorrow.