scripts.event_mapper

Module contents

Author: Carmen Meinson

class EventMapper(event_handlers: scripts.gesture_event_handlers.GestureEventHandlers)

Bases: object

switch_events_in_model(model: scripts.core.model.Model, event_names_to_remove: Set[str], event_names_to_add: Set[str]) None

Based on the given event names creates the GestureEvent instances to be added to the model. All the gestures and modules used by the given events will also be added to the model by the GestureLoader, if they have not been before Then all the events are switched in the model.

Removing an event may also lead to removing of some gestures that are no longer used by any events in the model. If all gestures from one module get removed so does the module.

Parameters
  • model (Model) – model in which to swich the events

  • event_names_to_remove (Set[str]) – names of the events to remove

  • event_names_to_add (Set[str]) – names of the events to add