示例#1
0
 def handle(self, event: object) -> None:
     """
     Handle events coming from elements.
     """
     if isinstance(event, UnlinkEvent):
         self._unlink_element(event.element)
         event = ElementDeleted(self, event.element)
     if self.event_manager and not self._block_events:
         self.event_manager.handle(event)
示例#2
0
 def handle(self, event: object) -> None:
     """Handle events coming from elements."""
     if isinstance(event, UnlinkEvent):
         element = event.element
         assert isinstance(element.id, str)
         try:
             del self._elements[element.id]
         except KeyError:
             return
         event = ElementDeleted(self, event.element)
     if self.event_manager and not self._block_events:
         self.event_manager.handle(event)
示例#3
0
 def _undo_create_event():
     try:
         del factory._elements[element.id]
     except KeyError:
         pass  # Key was probably already removed in an unlink call
     self.event_manager.handle(ElementDeleted(factory, element))