pyface.timer.i_timer module¶
Interfaces and base classes for cross-toolkit timers
This module defines interfaces for toolkit event-loop based timers. It also provides a base implementation that can be easily specialized for a particular back-end, and mixins that provide additional capabilities.
- class pyface.timer.i_timer.ITimer(adaptee, default=<class 'traits.adaptation.adaptation_error.AdaptationError'>)[source]¶
Bases:
Interface
Interface for timer classes.
This is a base interface which doesn’t specify any particular notification mechanism.
- interval = Range(low=0.0)¶
The interval at which to call the callback in seconds.
- repeat = Union(None, Int)¶
The number of times to repeat the callback, or None if no limit.
- expire = Union(None, Float)¶
The maximum length of time to run in seconds, or None if no limit.
- active = Bool()¶
Whether or not the timer is currently running.
- class pyface.timer.i_timer.IEventTimer(adaptee, default=<class 'traits.adaptation.adaptation_error.AdaptationError'>)[source]¶
Bases:
ITimer
Interface for timers which fire a trait event periodically.
- timeout = Event()¶
A traits Event to fire when the callback happens.
- class pyface.timer.i_timer.ICallbackTimer(adaptee, default=<class 'traits.adaptation.adaptation_error.AdaptationError'>)[source]¶
Bases:
ITimer
Interface for timers which call a callback periodically.
- callback = Callable¶
The callback to make, or None if no callback.
- args = Tuple()¶
Positional arguments to give the callback.
- kwargs = Dict()¶
Keyword arguments to give the callback.
- class pyface.timer.i_timer.BaseTimer[source]¶
Bases:
ABCHasTraits
Base class for timer classes.
This class has a class variable which tracks active timers to prevent failures caused by garbage collection. A timer is added to this tracker when it is started if the repeat value is not None.
- interval = Range(low=0.0, value=0.05)¶
The interval at which to call the callback in seconds.
- repeat = Union(None, Int)¶
The number of times to repeat the callback, or None if no limit.
- expire = Union(None, Float)¶
The maximum length of time to run in seconds, or None if no limit.
- active = Property(Bool, observe="_active")¶
Property that controls the state of the timer.