Package pytilities :: Package event :: Module dispatcherswitch :: Class DispatcherSwitch
[hide private]
[frames] | no frames]

Class DispatcherSwitch

source code

object --+
         |
        DispatcherSwitch


Provides a single interface to multiple event dispatchers.

Events are switched to the the first event dispatcher in a list of
dispatchers that supports the event, the other dispatchers are ignored for
that particular event.

This is also how remove_handlers will look for
handlers, it will only remove the handlers of each event's first found
dispatcher; the other ones are 'hidden' by this one, for this event.

Check `Dispatcher` for the documentation of the methods that are left
undocumented here.

Instance methods:

    - `append_dispatchers`: Add dispatchers to the list of dispatchers
    - ...

Instance Methods [hide private]
 
__init__(self)
x.__init__(...) initializes x; see x.__class__.__doc__ for signature
source code
 
append_dispatchers(self, *dispatchers)
Add dispatchers to the end of the list of dispatchers.
source code
 
__get_dispatcher_for_event(self, event_name)
Get the dispatcher for the given event according to our switching...
source code
 
add_handler(self, event_name, handler, owner=None) source code
 
remove_handlers(self, event_name=None, owner=None) source code
 
remove_handler(self, event_name, handler, owner=None) source code
 
event(self, event_name, owner=None) source code
 
has_event(self, event_name) source code
 
dispatch(self, event_name, *args, **keyword_args) source code
 
Delegator(profile_name='default', target=None)
Construct a delegator with a stored `Profile`.
source code
 
add_delegator_profile(name, profile)
Add a new delegator factory `Profile` to the factory.
source code

Inherited from object: __delattr__, __format__, __getattribute__, __hash__, __new__, __reduce__, __reduce_ex__, __repr__, __setattr__, __sizeof__, __str__, __subclasshook__

Static Methods [hide private]
 
__init_delegation_profiles(profiles) source code
Class Variables [hide private]
  _delegator_factory = <pytilities.delegation.delegatorfactory.D...
Properties [hide private]
  events

Inherited from object: __class__

Method Details [hide private]

__init__(self)
(Constructor)

source code 

x.__init__(...) initializes x; see x.__class__.__doc__ for signature

Overrides: object.__init__
(inherited documentation)

append_dispatchers(self, *dispatchers)

source code 

Add dispatchers to the end of the list of dispatchers.

Parameters:

    dispatchers :: (Dispatcher...)
        sequence of dispatchers to append

__get_dispatcher_for_event(self, event_name)

source code 

Get the dispatcher for the given event according to our switching
rules

add_handler(self, event_name, handler, owner=None)

source code 
Decorators:
  • @delegated("public")

remove_handlers(self, event_name=None, owner=None)

source code 
Decorators:
  • @delegated("public")

remove_handler(self, event_name, handler, owner=None)

source code 
Decorators:
  • @delegated("public")

event(self, event_name, owner=None)

source code 
Decorators:
  • @delegated("public")

has_event(self, event_name)

source code 
Decorators:
  • @delegated("public")

Delegator(profile_name='default', target=None)

source code 

Construct a delegator with a stored `Profile`.

Parameters:

    `profile_name` :: string
        name of the `Profile` to use to set up the delegator with

    `target` = None
        target of the newly created delegator

Returns newly created delegator :: Delegator

Raises:

    - `ValueError` when no profile with name `profile_name` exists

add_delegator_profile(name, profile)

source code 

Add a new delegator factory `Profile` to the factory.

Parameters:

    `name` :: string
        name of the profile

    `profile` :: Profile
        the profile to add


Class Variable Details [hide private]

_delegator_factory

Value:
<pytilities.delegation.delegatorfactory.DelegatorFactory object at 0x1\
770cd0>

Property Details [hide private]

events

Get Method:
unreachable.events(self)