Utilities and classes useful for user interfaces
Bases: object
Call object encapsulating any code, thus providing a simple facade for it :note: derive from it if a more complex call is required
Bases: object
Descriptor allowing to easily setup callbacks for classes derived from EventSender
Send our event using the given args
Note: | if an event listener is weak referenced and goes out of scope |
---|---|
Note: | will catch all event exceptions trown by the methods called |
Returns: | False if at least one event call threw an exception, true otherwise |
Bases: object
Base class for all classes that want to provide a common callback interface to supply event information to clients.
Usage: Derive from this class and define your callbacks like:
>>> event = Event() >>> # Call it using >>> self.event.send([*args][,**kwargs]])>>> # Users register using >>> yourinstance.event = callable>>> # and deregister using >>> yourinstance.event.remove(callable)
Note: | if use_weakref is True, we will weakref the eventfunction, and deal properly with instance methods which would go out of scope immediatly otherwise |
---|---|
Note: | using weak-references to ensure one does not keep objects alive, see Event.use_weakref |
Remove all event receivers for all events registered in this instance.
Note: | This usually doesn’t need to be called directly, but might be useful in conjunction with other system that do not release your strongly bound instance |
---|
Returns: | list of event ids that exist on our class |
---|
Returns: | instance which sent the event you are currently processing |
---|---|
Raises ValueError: | |
if no event is currently in progress |
Bases: object
Create a proper weak instance to an instance function by weakly binding the instance, not the bound function object. When called, the weakreferenced instance pointer will be retrieved, if possible, to finally make the call. If it could not be retrieved, the call will do nothing.