1313
1414
1515class HandlersRegistry :
16- """Manages the registration and retrieval of actions and their event handlers."""
17- _plugin_actions : list [SupportsEventHandlers ]
18- """List of registered actions."""
16+ """Manages the registration and retrieval of event handler catalogs and their event handlers."""
17+ _plugin_event_handler_catalogs : list [SupportsEventHandlers ]
18+ """List of registered actions and other event handler catalogs ."""
1919
2020 def __init__ (self ) -> None :
21- """Initialize an HandlersRegistry instance."""
22- self ._plugin_actions = []
21+ """Initialize a HandlersRegistry instance."""
22+ self ._plugin_event_handler_catalogs = []
2323
24- def register (self , action : SupportsEventHandlers ) -> None :
25- """Register an action with the registry.
24+ def register (self , catalog : SupportsEventHandlers ) -> None :
25+ """Register an event handler catalog with the registry.
2626
2727 Args:
28- action (Action ): The action to register.
28+ catalog (SupportsEventHandlers ): The event handler catalog to register.
2929 """
30- self ._plugin_actions .append (action )
30+ self ._plugin_event_handler_catalogs .append (catalog )
3131
3232 def get_event_handlers (self , event_name : EventNameStr , event_action_uuid : ActionUUIDStr | None = None ) -> Generator [EventHandlerFunc , None , None ]:
33- """Get all event handlers for a specific event from all registered actions .
33+ """Get all event handlers for a specific event from all registered event handler catalogs .
3434
3535 Args:
3636 event_name (EventName): The name of the event to retrieve handlers for.
@@ -40,11 +40,11 @@ def get_event_handlers(self, event_name: EventNameStr, event_action_uuid: Action
4040 Yields:
4141 EventHandlerFunc: The event handler functions for the specified event.
4242 """
43- for action in self ._plugin_actions :
43+ for catalog in self ._plugin_event_handler_catalogs :
4444 # If the event is action-specific (i.e is not a GlobalAction and has a UUID attribute),
4545 # only get handlers for that action, as we don't want to trigger
4646 # and pass this event to handlers for other actions.
47- if event_action_uuid is not None and (isinstance (action , Action ) and action .uuid != event_action_uuid ):
47+ if event_action_uuid is not None and (isinstance (catalog , Action ) and catalog .uuid != event_action_uuid ):
4848 continue
4949
50- yield from action .get_event_handlers (event_name )
50+ yield from catalog .get_event_handlers (event_name )
0 commit comments