예제 #1
0
파일: event.py 프로젝트: freeman-lab/napari
 def _invoke_callback(self, cb, event):
     try:
         cb(event)
     except Exception:
         _handle_exception(self.ignore_callback_errors,
                           self.print_callback_errors,
                           self, cb_event=(cb, event))
예제 #2
0
파일: event.py 프로젝트: tlambert03/napari
 def _invoke_callback(self, cb: Union[Callback, Callable[[], None]],
                      event: Optional[Event]):
     try:
         if event is not None:
             cb(event)
         else:
             cb()
     except Exception as e:
         # dead Qt object with living python pointer. not importing Qt
         # here... but this error is consistent across backends
         if (isinstance(e, RuntimeError) and 'C++' in str(e)
                 and str(e).endswith(
                     ('has been deleted', 'already deleted.'))):
             self.disconnect(cb)
             return
         _handle_exception(
             self.ignore_callback_errors,
             self.print_callback_errors,
             self,
             cb_event=(cb, event),
         )