async def run_app_async(cls_or_app, async_lib=None): """Entrance method used to start the App. It runs, or instantiates and runs a :class:`MoreKivyApp` type instance. """ from kivy.core.window import Window handler = _MoreKivyAppHandler() ExceptionManager.add_handler(handler) app = cls_or_app() if inspect.isclass(cls_or_app) else cls_or_app Window.fbind('on_request_close', app.ask_cannot_close) try: await app.async_run(async_lib=async_lib) except Exception as e: app.handle_exception(e, exc_info=sys.exc_info()) try: app.clean_up() except Exception as e: app.handle_exception(e, exc_info=sys.exc_info()) Window.funbind('on_request_close', app.ask_cannot_close) ExceptionManager.remove_handler(handler)
self.cam_lens_closer2.widget = widget = FormulaWidget( formula=self.cam_lens_closer2, description='((4/4) Fourth lens in the sequence.', name='L4') widget.populate_widget() container.add_widget(widget) from kivy.core.window import Window inspector.create_inspector(Window, root) return root if __name__ == '__main__': class _AppHandler(ExceptionHandler): def handle_exception(self, inst): Logger.error(inst, exc_info=sys.exc_info()) return ExceptionManager.PASS handler = _AppHandler() ExceptionManager.add_handler(handler) app = OpticsApp() try: app.run() except Exception as e: Logger.error(e, exc_info=sys.exc_info()) ExceptionManager.remove_handler(handler)
self.cam_lens_closer2.widget = widget = FormulaWidget( formula=self.cam_lens_closer2, description='((4/4) Fourth lens in the sequence.', name='L4') widget.populate_widget() container.add_widget(widget) from kivy.core.window import Window inspector.create_inspector(Window, root) return root if __name__ == '__main__': class _CPLComHandler(ExceptionHandler): def handle_exception(self, inst): Logger.error(inst, exc_info=sys.exc_info()) return ExceptionManager.PASS handler = _CPLComHandler() ExceptionManager.add_handler(handler) app = OpticsApp() try: app.run() except Exception as e: Logger.error(e, exc_info=sys.exc_info()) ExceptionManager.remove_handler(handler)