traits_futures.i_event_loop_helper module¶
Interface for toolkit-specific event loop helper class.
-
class
traits_futures.i_event_loop_helper.
IEventLoopHelper
[source]¶ Bases:
abc.ABC
Interface for toolkit-specific event loop helper class.
An IEventLoopHelper instance provides a way to run the event loop programmatically until a given condition occurs. Its primary use is in testing.
-
abstract
dispose
()[source]¶ Dispose of any resources used by this object.
This method is not thread-safe. It should always be called on the event loop’s thread.
-
abstract
init
()[source]¶ Prepare the event loop for use.
This method is not thread-safe. It should always be called on the event loop’s thread.
-
abstract
run_until
(object, trait, condition, timeout)[source]¶ Run event loop until a given condition occurs, or timeout.
The condition is re-evaluated, with the object as argument, every time the trait changes.
This method is not thread-safe. It should always be called on the event loop’s thread.
- Parameters
object (
traits.has_traits.HasTraits
) – Object whose trait we monitor.trait (
str
) – Name of the trait to monitor for changes.condition – Single-argument callable, returning a boolean. This will be called with object as the only input.
timeout (
float
) – Number of seconds to allow before timing out with an exception.
- Raises
RuntimeError – If timeout is reached, regardless of whether the condition is true or not at that point.
-
abstract