def _undo_create_event(): try: del factory._elements[element.id] except KeyError: pass # Key was probably already removed in an unlink call self.component_registry.handle(ElementDeleteEvent( factory, element))
def handle(self, event): """ Handle events coming from elements. """ if type(event) is UnlinkEvent: self._unlink_element(event.element) event = ElementDeleteEvent(self, event.element) if self.event_manager and not self._block_events: self.event_manager.handle(event)
def _unlink_element(self, element): """ NOTE: Invoked from Element.unlink() to perform an element unlink. """ self.component_registry.handle(ElementDeleteEvent(self, element)) super(ElementFactoryService, self)._unlink_element(element)